Address #584
Modify the build system to assume config files by default. Modify tidyplatform to accomodate these changes. Reformat tidyplatform for friendliness to new developers.
This commit is contained in:
parent
3658275f60
commit
a4e0409323
|
@ -157,17 +157,43 @@ if (TIDY_RC_NUMBER)
|
||||||
add_definitions ( -DRC_NUMBER="${TIDY_RC_NUMBER}" )
|
add_definitions ( -DRC_NUMBER="${TIDY_RC_NUMBER}" )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Issue #188 - Support user items in platform.h
|
|
||||||
if (TIDY_CONFIG_FILE)
|
#=============================================================================
|
||||||
add_definitions( -DTIDY_CONFIG_FILE="${TIDY_CONFIG_FILE}" )
|
# Unix console application features
|
||||||
endif ()
|
# By default on Unix-like systems when building for the console program,
|
||||||
if (TIDY_USER_CONFIG_FILE)
|
# support runtime configuration files in /etc/ and in ~/. To prevent this,
|
||||||
add_definitions( -DTIDY_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" )
|
# set ENABLE_CONFIG_FILES to NO. Specify -DTIDY_CONFIG_FILE and/or
|
||||||
endif ()
|
# -DTIDY_USER_CONFIG_FILE to override the default paths in tidyplatform.h.
|
||||||
if (SUPPORT_GETPWNAM)
|
# @note: this section refactored to support #584.
|
||||||
|
#=============================================================================
|
||||||
|
if (UNIX AND SUPPORT_CONSOLE_APP)
|
||||||
|
|
||||||
|
option ( ENABLE_CONFIG_FILES "Set to OFF to disable Tidy runtime configuration file support" ON )
|
||||||
|
|
||||||
|
if ( ENABLE_CONFIG_FILES )
|
||||||
|
|
||||||
|
message(STATUS "*** Building support for runtime configuration files.")
|
||||||
|
|
||||||
|
add_definitions( -DTIDY_ENABLE_CONFIG_FILES )
|
||||||
|
|
||||||
|
# For example, /etc/tidy.conf
|
||||||
|
if (TIDY_CONFIG_FILE)
|
||||||
|
add_definitions( -DTIDY_CONFIG_FILE="${TIDY_CONFIG_FILE}" )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# For example, ~/.tidy.rc
|
||||||
|
if (TIDY_USER_CONFIG_FILE)
|
||||||
|
add_definitions( -DTIDY_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# All Unixes support getpwnam(); undef'd in tidyplatform.h if necessary.
|
||||||
add_definitions( -DSUPPORT_GETPWNAM=1 )
|
add_definitions( -DSUPPORT_GETPWNAM=1 )
|
||||||
|
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(BUILD_SHARED_LIB)
|
if(BUILD_SHARED_LIB)
|
||||||
set(LIB_TYPE SHARED)
|
set(LIB_TYPE SHARED)
|
||||||
message(STATUS "*** Also building DLL library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}")
|
message(STATUS "*** Also building DLL library ${LIB_TYPE}, version ${LIBTIDY_VERSION}, date ${LIBTIDY_DATE}")
|
||||||
|
|
|
@ -862,7 +862,7 @@ static void help(TidyDoc tdoc, /**< The tidy document for which help is showing.
|
||||||
ctmbstr prog /**< The path of the current executable. */
|
ctmbstr prog /**< The path of the current executable. */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
tmbstr title_line = NULL;
|
tmbstr temp_string = NULL;
|
||||||
uint width = 78;
|
uint width = 78;
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -870,19 +870,26 @@ static void help(TidyDoc tdoc, /**< The tidy document for which help is showing.
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
#ifdef PLATFORM_NAME
|
#ifdef PLATFORM_NAME
|
||||||
title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2A), PLATFORM_NAME);
|
temp_string = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2A), PLATFORM_NAME);
|
||||||
#else
|
#else
|
||||||
title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2B) );
|
title_line = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_2B) );
|
||||||
#endif
|
#endif
|
||||||
width = width < strlen(title_line) ? width : strlen(title_line);
|
width = width < strlen(temp_string) ? width : strlen(temp_string);
|
||||||
printf( "%s\n", title_line );
|
printf( "%s\n", temp_string );
|
||||||
printf( "%*.*s\n\n", width, width, ul);
|
printf( "%*.*s\n\n", width, width, ul);
|
||||||
free( title_line );
|
free( temp_string );
|
||||||
|
|
||||||
print_help_options( tdoc );
|
print_help_options( tdoc );
|
||||||
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf( "%s", tidyLocalizedString(TC_TXT_HELP_3) );
|
#if defined(TIDY_CONFIG_FILE) && defined(TIDY_USER_CONFIG_FILE)
|
||||||
|
temp_string = stringWithFormat( tidyLocalizedString(TC_TXT_HELP_3A), TIDY_CONFIG_FILE, TIDY_USER_CONFIG_FILE );
|
||||||
|
printf( tidyLocalizedString(TC_TXT_HELP_3), temp_string );
|
||||||
|
free( temp_string );
|
||||||
|
#else
|
||||||
|
printf( tidyLocalizedString(TC_TXT_HELP_3), "\n" );
|
||||||
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -486,6 +486,7 @@ extern "C" {
|
||||||
FN(TC_TXT_HELP_2A) \
|
FN(TC_TXT_HELP_2A) \
|
||||||
FN(TC_TXT_HELP_2B) \
|
FN(TC_TXT_HELP_2B) \
|
||||||
FN(TC_TXT_HELP_3) \
|
FN(TC_TXT_HELP_3) \
|
||||||
|
FN(TC_TXT_HELP_3A) \
|
||||||
FN(TC_TXT_HELP_CONFIG) \
|
FN(TC_TXT_HELP_CONFIG) \
|
||||||
FN(TC_TXT_HELP_CONFIG_NAME) \
|
FN(TC_TXT_HELP_CONFIG_NAME) \
|
||||||
FN(TC_TXT_HELP_CONFIG_TYPE) \
|
FN(TC_TXT_HELP_CONFIG_TYPE) \
|
||||||
|
|
|
@ -32,342 +32,343 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*=============================================================================
|
||||||
Uncomment and edit one of the following #defines if you
|
* Unix console application features
|
||||||
want to specify the config file at compile-time.
|
* 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
|
||||||
|
* -DTIDY_USER_CONFIG_FILE to override the default paths in tidyplatform.h.
|
||||||
|
* @note: this section refactored to support #584.
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
/* #define TIDY_CONFIG_FILE "/etc/tidy_config.txt" */ /* original */
|
/* #define ENABLE_CONFIG_FILES */
|
||||||
/* #define TIDY_CONFIG_FILE "/etc/tidyrc" */
|
|
||||||
/* #define TIDY_CONFIG_FILE "/etc/tidy.conf" */
|
|
||||||
|
|
||||||
/*
|
#if defined(TIDY_ENABLE_CONFIG_FILES)
|
||||||
Uncomment the following #define if you are on a system
|
# if !defined(TIDY_CONFIG_FILE)
|
||||||
supporting the HOME environment variable.
|
# define TIDY_CONFIG_FILE "/etc/tidy.conf"
|
||||||
It enables tidy to find config files named ~/.tidyrc if
|
# endif
|
||||||
the HTML_TIDY environment variable is not set.
|
# if !defined(TIDY_USER_CONFIG_FILE)
|
||||||
*/
|
# define TIDY_USER_CONFIG_FILE "~/.tidyrc"
|
||||||
/* #define TIDY_USER_CONFIG_FILE "~/.tidyrc" */
|
# endif
|
||||||
|
#else
|
||||||
|
# if defined(TIDY_CONFIG_FILE)
|
||||||
|
# undef TIDY_CONFIG_FILE
|
||||||
|
# endif
|
||||||
|
# if defined(TIDY_USER_CONFIG_FILE)
|
||||||
|
# undef TIDY_USER_CONFIG_FILE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
Uncomment the following #define if your
|
|
||||||
system supports the call getpwnam().
|
|
||||||
E.g. Unix and Linux.
|
|
||||||
|
|
||||||
It enables tidy to find files named
|
/*=============================================================================
|
||||||
~your/foo for use in the HTML_TIDY environment
|
* Unix tilde expansion support
|
||||||
variable or CONFIG_FILE or USER_CONFIGFILE or
|
* By default on Unix-like systems when building for the console program,
|
||||||
on the command line: -config ~joebob/tidy.cfg
|
* this flag is set so that Tidy knows getpwname() is available. It allows
|
||||||
|
* tidy to find files named ~your/foo for use in the HTML_TIDY environment
|
||||||
Contributed by Todd Lewis.
|
* variable or TIDY_CONFIG_FILE or TIDY_USER_CONFIG_FILE or on the command
|
||||||
*/
|
* command line: -config ~joebob/tidy.cfg
|
||||||
|
* Contributed by Todd Lewis.
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
/* #define SUPPORT_GETPWNAM */
|
/* #define SUPPORT_GETPWNAM */
|
||||||
|
|
||||||
|
|
||||||
|
/*=============================================================================
|
||||||
|
* Optional Tidy features support
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
/* Enable/disable support for Big5 and Shift_JIS character encodings */
|
/* Enable/disable support for Big5 and Shift_JIS character encodings */
|
||||||
#ifndef SUPPORT_ASIAN_ENCODINGS
|
#ifndef SUPPORT_ASIAN_ENCODINGS
|
||||||
#define SUPPORT_ASIAN_ENCODINGS 1
|
# define SUPPORT_ASIAN_ENCODINGS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable/disable support for UTF-16 character encodings */
|
/* Enable/disable support for UTF-16 character encodings */
|
||||||
#ifndef SUPPORT_UTF16_ENCODINGS
|
#ifndef SUPPORT_UTF16_ENCODINGS
|
||||||
#define SUPPORT_UTF16_ENCODINGS 1
|
# define SUPPORT_UTF16_ENCODINGS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable/disable support for additional accessibility checks */
|
/* Enable/disable support for additional accessibility checks */
|
||||||
#ifndef SUPPORT_ACCESSIBILITY_CHECKS
|
#ifndef SUPPORT_ACCESSIBILITY_CHECKS
|
||||||
#define SUPPORT_ACCESSIBILITY_CHECKS 1
|
# define SUPPORT_ACCESSIBILITY_CHECKS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable/disable support for additional languages */
|
/* Enable/disable support for additional languages */
|
||||||
#ifndef SUPPORT_LOCALIZATIONS
|
#ifndef SUPPORT_LOCALIZATIONS
|
||||||
#define SUPPORT_LOCALIZATIONS 1
|
# define SUPPORT_LOCALIZATIONS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable/disable support for console */
|
/* Enable/disable support for console */
|
||||||
#ifndef SUPPORT_CONSOLE_APP
|
#ifndef SUPPORT_CONSOLE_APP
|
||||||
#define SUPPORT_CONSOLE_APP 1
|
# define SUPPORT_CONSOLE_APP 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Convenience defines for Mac platforms */
|
/*=============================================================================
|
||||||
|
* Platform specific convenience definitions
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
|
/* === Convenience defines for Mac platforms === */
|
||||||
|
|
||||||
#if defined(macintosh)
|
#if defined(macintosh)
|
||||||
/* Mac OS 6.x/7.x/8.x/9.x, with or without CarbonLib - MPW or Metrowerks 68K/PPC compilers */
|
/* Mac OS 6.x/7.x/8.x/9.x, with or without CarbonLib - MPW or Metrowerks 68K/PPC compilers */
|
||||||
#define MAC_OS_CLASSIC
|
# define MAC_OS_CLASSIC
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Mac OS"
|
# define PLATFORM_NAME "Mac OS"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* needed for access() */
|
/* needed for access() */
|
||||||
#if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT)
|
# if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT)
|
||||||
#define NO_ACCESS_SUPPORT
|
# define NO_ACCESS_SUPPORT
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifdef SUPPORT_GETPWNAM
|
# ifdef SUPPORT_GETPWNAM
|
||||||
#undef SUPPORT_GETPWNAM
|
# undef SUPPORT_GETPWNAM
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(__APPLE__) && defined(__MACH__)
|
#elif defined(__APPLE__) && defined(__MACH__)
|
||||||
/* Mac OS X (client) 10.x (or server 1.x/10.x) - gcc or Metrowerks MachO compilers */
|
/* Mac OS X (client) 10.x (or server 1.x/10.x) - gcc or Metrowerks MachO compilers */
|
||||||
#define MAC_OS_X
|
# define MAC_OS_X
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Mac OS X"
|
# define PLATFORM_NAME "Mac OS X"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X)
|
#if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X)
|
||||||
/* Any OS on Mac platform */
|
/* Any OS on Mac platform */
|
||||||
#define MAC_OS
|
# define MAC_OS
|
||||||
#define FILENAMES_CASE_SENSITIVE 0
|
# define FILENAMES_CASE_SENSITIVE 0
|
||||||
#define strcasecmp strcmp
|
# define strcasecmp strcmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for BSD like platforms */
|
/* === Convenience defines for BSD-like platforms === */
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
#define BSD_BASED_OS
|
# define BSD_BASED_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "FreeBSD"
|
# define PLATFORM_NAME "FreeBSD"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#define BSD_BASED_OS
|
# define BSD_BASED_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "NetBSD"
|
# define PLATFORM_NAME "NetBSD"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined(__OpenBSD__)
|
||||||
#define BSD_BASED_OS
|
# define BSD_BASED_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "OpenBSD"
|
# define PLATFORM_NAME "OpenBSD"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(__DragonFly__)
|
#elif defined(__DragonFly__)
|
||||||
#define BSD_BASED_OS
|
# define BSD_BASED_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "DragonFly"
|
# define PLATFORM_NAME "DragonFly"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(__MINT__)
|
#elif defined(__MINT__)
|
||||||
#define BSD_BASED_OS
|
# define BSD_BASED_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "FreeMiNT"
|
# define PLATFORM_NAME "FreeMiNT"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(__bsdi__)
|
#elif defined(__bsdi__)
|
||||||
#define BSD_BASED_OS
|
# define BSD_BASED_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "BSD/OS"
|
# define PLATFORM_NAME "BSD/OS"
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
/* === Convenience defines for Windows platforms === */
|
||||||
|
|
||||||
/* Convenience defines for Windows platforms */
|
|
||||||
|
|
||||||
#if defined(WINDOWS) || defined(_WIN32)
|
#if defined(WINDOWS) || defined(_WIN32)
|
||||||
|
|
||||||
#define WINDOWS_OS
|
# define WINDOWS_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Windows"
|
# define PLATFORM_NAME "Windows"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#if defined(__MWERKS__) || defined(__MSL__)
|
# if defined(__MWERKS__) || defined(__MSL__)
|
||||||
/* not available with Metrowerks Standard Library */
|
/* not available with Metrowerks Standard Library */
|
||||||
|
# ifdef SUPPORT_GETPWNAM
|
||||||
|
# undef SUPPORT_GETPWNAM
|
||||||
|
# endif
|
||||||
|
/* needed for setmode() */
|
||||||
|
# if !defined(NO_SETMODE_SUPPORT)
|
||||||
|
# define NO_SETMODE_SUPPORT
|
||||||
|
# endif
|
||||||
|
# define strcasecmp _stricmp
|
||||||
|
# endif
|
||||||
|
|
||||||
#ifdef SUPPORT_GETPWNAM
|
# if defined(__BORLANDC__)
|
||||||
#undef SUPPORT_GETPWNAM
|
# define strcasecmp stricmp
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* needed for setmode() */
|
# define FILENAMES_CASE_SENSITIVE 0
|
||||||
#if !defined(NO_SETMODE_SUPPORT)
|
# define SUPPORT_POSIX_MAPPED_FILES 0
|
||||||
#define NO_SETMODE_SUPPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define strcasecmp _stricmp
|
#endif /* WINDOWS */
|
||||||
|
|
||||||
#endif
|
/* === Convenience defines for Linux platforms === */
|
||||||
|
|
||||||
#if defined(__BORLANDC__)
|
|
||||||
#define strcasecmp stricmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FILENAMES_CASE_SENSITIVE 0
|
|
||||||
#define SUPPORT_POSIX_MAPPED_FILES 0
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Convenience defines for Linux platforms */
|
|
||||||
|
|
||||||
#if defined(linux) && defined(__alpha__)
|
#if defined(linux) && defined(__alpha__)
|
||||||
/* Linux on Alpha - gcc compiler */
|
/* Linux on Alpha - gcc compiler */
|
||||||
#define LINUX_OS
|
# define LINUX_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Linux/Alpha"
|
# define PLATFORM_NAME "Linux/Alpha"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(linux) && defined(__sparc__)
|
#elif defined(linux) && defined(__sparc__)
|
||||||
/* Linux on Sparc - gcc compiler */
|
/* Linux on Sparc - gcc compiler */
|
||||||
#define LINUX_OS
|
# define LINUX_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Linux/Sparc"
|
# define PLATFORM_NAME "Linux/Sparc"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__))
|
#elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__))
|
||||||
/* Linux on x86 - gcc compiler */
|
/* Linux on x86 - gcc compiler */
|
||||||
#define LINUX_OS
|
# define LINUX_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Linux/x86"
|
# define PLATFORM_NAME "Linux/x86"
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#elif defined(linux) && defined(__powerpc__)
|
#elif defined(linux) && defined(__powerpc__)
|
||||||
/* Linux on PPC - gcc compiler */
|
/* Linux on PPC - gcc compiler */
|
||||||
#define LINUX_OS
|
# define LINUX_OS
|
||||||
|
# if defined(__linux__) && defined(__powerpc__)
|
||||||
#if defined(__linux__) && defined(__powerpc__)
|
# ifndef PLATFORM_NAME
|
||||||
|
/* MkLinux on PPC - gcc (egcs) compiler */
|
||||||
/* #if #system(linux) */
|
# define PLATFORM_NAME "MkLinux"
|
||||||
/* MkLinux on PPC - gcc (egcs) compiler */
|
# endif
|
||||||
/* #define MAC_OS_MKLINUX */
|
# else
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "MkLinux"
|
# define PLATFORM_NAME "Linux/PPC"
|
||||||
#endif
|
# endif
|
||||||
|
# endif
|
||||||
#else
|
|
||||||
|
|
||||||
#ifndef PLATFORM_NAME
|
|
||||||
#define PLATFORM_NAME "Linux/PPC"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(linux) || defined(__linux__)
|
#elif defined(linux) || defined(__linux__)
|
||||||
/* generic Linux */
|
/* generic Linux */
|
||||||
#define LINUX_OS
|
# define LINUX_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Linux"
|
# define PLATFORM_NAME "Linux"
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
/* === Convenience defines for Solaris platforms === */
|
||||||
|
|
||||||
/* Convenience defines for Solaris platforms */
|
|
||||||
|
|
||||||
#if defined(sun)
|
#if defined(sun)
|
||||||
#define SOLARIS_OS
|
# define SOLARIS_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Solaris"
|
# define PLATFORM_NAME "Solaris"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for HPUX + gcc platforms */
|
/* === Convenience defines for HPUX + gcc platforms === */
|
||||||
|
|
||||||
#if defined(__hpux)
|
#if defined(__hpux)
|
||||||
#define HPUX_OS
|
# define HPUX_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "HPUX"
|
# define PLATFORM_NAME "HPUX"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for RISCOS + gcc platforms */
|
/* === Convenience defines for RISCOS + gcc platforms === */
|
||||||
|
|
||||||
#if defined(__riscos__)
|
#if defined(__riscos__)
|
||||||
#define RISC_OS
|
# define RISC_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "RISC OS"
|
# define PLATFORM_NAME "RISC OS"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for OS/2 + icc/gcc platforms */
|
/* === Convenience defines for OS/2 + icc/gcc platforms === */
|
||||||
|
|
||||||
#if defined(__OS2__) || defined(__EMX__)
|
#if defined(__OS2__) || defined(__EMX__)
|
||||||
#define OS2_OS
|
# define OS2_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "OS/2"
|
# define PLATFORM_NAME "OS/2"
|
||||||
#endif
|
# endif
|
||||||
#define FILENAMES_CASE_SENSITIVE 0
|
# define FILENAMES_CASE_SENSITIVE 0
|
||||||
#define strcasecmp stricmp
|
# define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for IRIX */
|
/* === Convenience defines for IRIX === */
|
||||||
|
|
||||||
#if defined(__sgi)
|
#if defined(__sgi)
|
||||||
#define IRIX_OS
|
# define IRIX_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "SGI IRIX"
|
# define PLATFORM_NAME "SGI IRIX"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for AIX */
|
/* === Convenience defines for AIX === */
|
||||||
|
|
||||||
#if defined(_AIX)
|
#if defined(_AIX)
|
||||||
#define AIX_OS
|
# define AIX_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "IBM AIX"
|
# define PLATFORM_NAME "IBM AIX"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* === Convenience defines for BeOS platforms === */
|
||||||
/* Convenience defines for BeOS platforms */
|
|
||||||
|
|
||||||
#if defined(__BEOS__)
|
#if defined(__BEOS__)
|
||||||
#define BE_OS
|
# define BE_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "BeOS"
|
# define PLATFORM_NAME "BeOS"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for Cygwin platforms */
|
/* === Convenience defines for Cygwin platforms === */
|
||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
#define CYGWIN_OS
|
# define CYGWIN_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "Cygwin"
|
# define PLATFORM_NAME "Cygwin"
|
||||||
#endif
|
# endif
|
||||||
#define FILENAMES_CASE_SENSITIVE 0
|
# define FILENAMES_CASE_SENSITIVE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for OpenVMS */
|
/* === Convenience defines for OpenVMS === */
|
||||||
|
|
||||||
#if defined(__VMS)
|
#if defined(__VMS)
|
||||||
#define OPENVMS_OS
|
# define OPENVMS_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "OpenVMS"
|
# define PLATFORM_NAME "OpenVMS"
|
||||||
#endif
|
# endif
|
||||||
#define FILENAMES_CASE_SENSITIVE 0
|
# define FILENAMES_CASE_SENSITIVE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for DEC Alpha OSF + gcc platforms */
|
/* === Convenience defines for DEC Alpha OSF + gcc platforms === */
|
||||||
|
|
||||||
#if defined(__osf__)
|
#if defined(__osf__)
|
||||||
#define OSF_OS
|
# define OSF_OS
|
||||||
#ifndef PLATFORM_NAME
|
# ifndef PLATFORM_NAME
|
||||||
#define PLATFORM_NAME "DEC Alpha OSF"
|
# define PLATFORM_NAME "DEC Alpha OSF"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convenience defines for ARM platforms */
|
/* === Convenience defines for ARM platforms === */
|
||||||
|
|
||||||
#if defined(__arm)
|
#if defined(__arm)
|
||||||
#define ARM_OS
|
# define ARM_OS
|
||||||
|
# if defined(forARM) && defined(__NEWTON_H)
|
||||||
#if defined(forARM) && defined(__NEWTON_H)
|
/* Using Newton C++ Tools ARMCpp compiler */
|
||||||
|
# define NEWTON_OS
|
||||||
/* Using Newton C++ Tools ARMCpp compiler */
|
# ifndef PLATFORM_NAME
|
||||||
#define NEWTON_OS
|
# define PLATFORM_NAME "Newton"
|
||||||
#ifndef PLATFORM_NAME
|
# endif
|
||||||
#define PLATFORM_NAME "Newton"
|
# else
|
||||||
|
# ifndef PLATFORM_NAME
|
||||||
|
# define PLATFORM_NAME "ARM"
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifndef PLATFORM_NAME
|
/*=============================================================================
|
||||||
#define PLATFORM_NAME "ARM"
|
* Standard Library Includes
|
||||||
#endif
|
*===========================================================================*/
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -378,193 +379,207 @@ extern "C" {
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef NEEDS_MALLOC_H
|
#ifdef NEEDS_MALLOC_H
|
||||||
#include <malloc.h>
|
# include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SUPPORT_GETPWNAM
|
#ifdef SUPPORT_GETPWNAM
|
||||||
#include <pwd.h>
|
# include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NEEDS_UNISTD_H
|
#ifdef NEEDS_UNISTD_H
|
||||||
#include <unistd.h> /* needed for unlink on some Unix systems */
|
# include <unistd.h> /* needed for unlink on some Unix systems */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* By default, use case-sensitive filename comparison.
|
|
||||||
*/
|
/*=============================================================================
|
||||||
|
* Case sensitive file systems
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
|
/* By default, use case-sensitive filename comparison. */
|
||||||
#ifndef FILENAMES_CASE_SENSITIVE
|
#ifndef FILENAMES_CASE_SENSITIVE
|
||||||
#define FILENAMES_CASE_SENSITIVE 1
|
# define FILENAMES_CASE_SENSITIVE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*=============================================================================
|
||||||
Tidy preserves the last modified time for the files it
|
* Last modified time preservation
|
||||||
cleans up.
|
* Tidy preserves the last modified time for the files it cleans up.
|
||||||
*/
|
*
|
||||||
|
* If your platform doesn't support <utime.h> and the utime() function, or
|
||||||
/*
|
* <sys/futime> and the futime() function then set PRESERVE_FILE_TIMES to 0.
|
||||||
If your platform doesn't support <utime.h> and the
|
*
|
||||||
utime() function, or <sys/futime> and the futime()
|
* If your platform doesn't support <sys/utime.h> and the futime() function,
|
||||||
function then set PRESERVE_FILE_TIMES to 0.
|
* then set HAS_FUTIME to 0.
|
||||||
|
*
|
||||||
If your platform doesn't support <sys/utime.h> and the
|
* If your platform supports <utime.h> and the utime() function requires the
|
||||||
futime() function, then set HAS_FUTIME to 0.
|
* file to be closed first, then set UTIME_NEEDS_CLOSED_FILE to 1.
|
||||||
|
*===========================================================================*/
|
||||||
If your platform supports <utime.h> and the
|
|
||||||
utime() function requires the file to be
|
|
||||||
closed first, then set UTIME_NEEDS_CLOSED_FILE to 1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Keep old PRESERVEFILETIMES define for compatibility */
|
/* Keep old PRESERVEFILETIMES define for compatibility */
|
||||||
#ifdef PRESERVEFILETIMES
|
#ifdef PRESERVEFILETIMES
|
||||||
#undef PRESERVE_FILE_TIMES
|
# undef PRESERVE_FILE_TIMES
|
||||||
#define PRESERVE_FILE_TIMES PRESERVEFILETIMES
|
# define PRESERVE_FILE_TIMES PRESERVEFILETIMES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PRESERVE_FILE_TIMES
|
#ifndef PRESERVE_FILE_TIMES
|
||||||
#if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS)
|
# if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS)
|
||||||
#define PRESERVE_FILE_TIMES 0
|
# define PRESERVE_FILE_TIMES 0
|
||||||
#else
|
# else
|
||||||
#define PRESERVE_FILE_TIMES 1
|
# define PRESERVE_FILE_TIMES 1
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PRESERVE_FILE_TIMES
|
#if PRESERVE_FILE_TIMES
|
||||||
|
|
||||||
#ifndef HAS_FUTIME
|
# ifndef HAS_FUTIME
|
||||||
#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__) || defined(__GLIBC__)
|
# if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__) || defined(__GLIBC__)
|
||||||
#define HAS_FUTIME 0
|
# define HAS_FUTIME 0
|
||||||
#else
|
# else
|
||||||
#define HAS_FUTIME 1
|
# define HAS_FUTIME 1
|
||||||
#endif
|
# endif
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifndef UTIME_NEEDS_CLOSED_FILE
|
# ifndef UTIME_NEEDS_CLOSED_FILE
|
||||||
#if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS)
|
# if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS)
|
||||||
#define UTIME_NEEDS_CLOSED_FILE 1
|
# define UTIME_NEEDS_CLOSED_FILE 1
|
||||||
#else
|
# else
|
||||||
#define UTIME_NEEDS_CLOSED_FILE 0
|
# define UTIME_NEEDS_CLOSED_FILE 0
|
||||||
#endif
|
# endif
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__))
|
# if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__))
|
||||||
#include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
#else
|
# else
|
||||||
#include <stat.h>
|
# include <stat.h>
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#if HAS_FUTIME
|
# if HAS_FUTIME
|
||||||
#include <sys/utime.h>
|
# include <sys/utime.h>
|
||||||
#else
|
# else
|
||||||
#include <utime.h>
|
# include <utime.h>
|
||||||
#endif /* HASFUTIME */
|
# endif
|
||||||
|
|
||||||
/*
|
/* MS Windows needs _ prefix for Unix file functions.
|
||||||
MS Windows needs _ prefix for Unix file functions.
|
Not required by Metrowerks Standard Library (MSL).
|
||||||
Not required by Metrowerks Standard Library (MSL).
|
|
||||||
|
|
||||||
Tidy uses following for preserving the last modified time.
|
Tidy uses following for preserving the last modified time.
|
||||||
|
|
||||||
WINDOWS automatically set by Win16 compilers.
|
WINDOWS automatically set by Win16 compilers.
|
||||||
_WIN32 automatically set by Win32 compilers.
|
_WIN32 automatically set by Win32 compilers.
|
||||||
*/
|
*/
|
||||||
|
# if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
|
||||||
|
# define futime _futime
|
||||||
|
# define fstat _fstat
|
||||||
|
# define utimbuf _utimbuf /* Windows seems to want utimbuf */
|
||||||
|
# define stat _stat
|
||||||
|
# define utime _utime
|
||||||
|
# define vsnprintf _vsnprintf
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*=============================================================================
|
||||||
|
* Windows file functions
|
||||||
|
* Windows needs _ prefix for Unix file functions.
|
||||||
|
* Not required by Metrowerks Standard Library (MSL).
|
||||||
|
*
|
||||||
|
* WINDOWS automatically set by Win16 compilers.
|
||||||
|
* _WIN32 automatically set by Win32 compilers.
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
|
#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
|
||||||
|
|
||||||
#define futime _futime
|
# if !(defined(__WATCOMC__) || defined(__MINGW32__))
|
||||||
#define fstat _fstat
|
# define fileno _fileno
|
||||||
#define utimbuf _utimbuf /* Windows seems to want utimbuf */
|
# define setmode _setmode
|
||||||
#define stat _stat
|
# endif
|
||||||
#define utime _utime
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
#endif /* PRESERVE_FILE_TIMES */
|
# define access _access
|
||||||
|
# define strcasecmp _stricmp
|
||||||
|
|
||||||
/*
|
# ifndef va_copy
|
||||||
MS Windows needs _ prefix for Unix file functions.
|
# define va_copy(dest, src) (dest = src)
|
||||||
Not required by Metrowerks Standard Library (MSL).
|
# endif
|
||||||
|
|
||||||
WINDOWS automatically set by Win16 compilers.
|
# if _MSC_VER > 1000
|
||||||
_WIN32 automatically set by Win32 compilers.
|
# pragma warning( disable : 4189 ) /* local variable is initialized but not referenced */
|
||||||
*/
|
# pragma warning( disable : 4100 ) /* unreferenced formal parameter */
|
||||||
#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
|
# pragma warning( disable : 4706 ) /* assignment within conditional expression */
|
||||||
|
# endif
|
||||||
|
|
||||||
#if !(defined(__WATCOMC__) || defined(__MINGW32__))
|
# if _MSC_VER > 1300
|
||||||
#define fileno _fileno
|
# pragma warning( disable : 4996 ) /* disable depreciation warning */
|
||||||
#define setmode _setmode
|
# endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#define access _access
|
|
||||||
#define strcasecmp _stricmp
|
|
||||||
|
|
||||||
#ifndef va_copy
|
|
||||||
#define va_copy(dest, src) (dest = src)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
|
||||||
#pragma warning( disable : 4189 ) /* local variable is initialized but not referenced */
|
|
||||||
#pragma warning( disable : 4100 ) /* unreferenced formal parameter */
|
|
||||||
#pragma warning( disable : 4706 ) /* assignment within conditional expression */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _MSC_VER > 1300
|
|
||||||
#pragma warning( disable : 4996 ) /* disable depreciation warning */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#if (defined(_USRDLL) || defined(_WINDLL) || defined(BUILD_SHARED_LIB)) && !defined(TIDY_EXPORT) && !defined(TIDY_STATIC)
|
# if (defined(_USRDLL) || defined(_WINDLL) || defined(BUILD_SHARED_LIB)) && !defined(TIDY_EXPORT) && !defined(TIDY_STATIC)
|
||||||
#ifdef BUILDING_SHARED_LIB
|
# ifdef BUILDING_SHARED_LIB
|
||||||
#define TIDY_EXPORT __declspec( dllexport )
|
# define TIDY_EXPORT __declspec( dllexport )
|
||||||
#else
|
# else
|
||||||
#define TIDY_EXPORT __declspec( dllimport )
|
# define TIDY_EXPORT __declspec( dllimport )
|
||||||
#endif
|
# endif
|
||||||
#else
|
# else
|
||||||
#define TIDY_EXPORT extern
|
# define TIDY_EXPORT extern
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifndef TIDY_CALL
|
# ifndef TIDY_CALL
|
||||||
#ifdef _WIN64
|
# ifdef _WIN64
|
||||||
# define TIDY_CALL __fastcall
|
# define TIDY_CALL __fastcall
|
||||||
#else
|
# else
|
||||||
# define TIDY_CALL __stdcall
|
# define TIDY_CALL __stdcall
|
||||||
#endif
|
# endif
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
/* hack for gnu sys/types.h file which defines uint and ulong */
|
|
||||||
|
/*=============================================================================
|
||||||
|
* Hack for gnu sys/types.h file which defines uint and ulong
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
#if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
|
#if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
|
||||||
#include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif
|
|
||||||
#if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS)
|
|
||||||
# undef uint
|
|
||||||
typedef unsigned int uint;
|
|
||||||
#endif
|
|
||||||
#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
|
|
||||||
# undef ulong
|
|
||||||
typedef unsigned long ulong;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
#if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS)
|
||||||
With GCC 4, __attribute__ ((visibility("default"))) can be used along compiling with tidylib
|
# undef uint
|
||||||
with "-fvisibility=hidden". See http://gcc.gnu.org/wiki/Visibility and build/gmake/Makefile.
|
typedef unsigned int uint;
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
|
#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
|
||||||
|
# undef ulong
|
||||||
|
typedef unsigned long ulong;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*=============================================================================
|
||||||
|
* Visibility support
|
||||||
|
* With GCC 4, __attribute__ ((visibility("default"))) can be used
|
||||||
|
* along compiling with tidylib with "-fvisibility=hidden". See
|
||||||
|
* http://gcc.gnu.org/wiki/Visibility and build/gmake/Makefile.
|
||||||
|
*===========================================================================*/
|
||||||
/*
|
/*
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||||
#define TIDY_EXPORT __attribute__ ((visibility("default")))
|
# define TIDY_EXPORT __attribute__ ((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*=============================================================================
|
||||||
|
* Other definitions
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
#ifndef TIDY_EXPORT /* Define it away for most builds */
|
#ifndef TIDY_EXPORT /* Define it away for most builds */
|
||||||
#define TIDY_EXPORT
|
# define TIDY_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TIDY_STRUCT
|
#ifndef TIDY_STRUCT
|
||||||
#define TIDY_STRUCT
|
# define TIDY_STRUCT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
@ -572,41 +587,39 @@ typedef unsigned char byte;
|
||||||
typedef uint tchar; /* single, full character */
|
typedef uint tchar; /* single, full character */
|
||||||
typedef char tmbchar; /* single, possibly partial character */
|
typedef char tmbchar; /* single, possibly partial character */
|
||||||
#ifndef TMBSTR_DEFINED
|
#ifndef TMBSTR_DEFINED
|
||||||
typedef tmbchar* tmbstr; /* pointer to buffer of possibly partial chars */
|
typedef tmbchar* tmbstr; /* pointer to buffer of possibly partial chars */
|
||||||
typedef const tmbchar* ctmbstr; /* Ditto, but const */
|
typedef const tmbchar* ctmbstr; /* Ditto, but const */
|
||||||
#define NULLSTR (tmbstr)""
|
# define NULLSTR (tmbstr)""
|
||||||
#define TMBSTR_DEFINED
|
# define TMBSTR_DEFINED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TIDY_CALL
|
#ifndef TIDY_CALL
|
||||||
#define TIDY_CALL
|
# define TIDY_CALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
||||||
# define ARG_UNUSED(x) x __attribute__((unused))
|
# define ARG_UNUSED(x) x __attribute__((unused))
|
||||||
# define FUNC_UNUSED __attribute__((unused))
|
# define FUNC_UNUSED __attribute__((unused))
|
||||||
#else
|
#else
|
||||||
# define ARG_UNUSED(x) x
|
# define ARG_UNUSED(x) x
|
||||||
# define FUNC_UNUSED
|
# define FUNC_UNUSED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* HAS_VSNPRINTF triggers the use of "vsnprintf", which is safe related to
|
/* HAS_VSNPRINTF triggers the use of "vsnprintf", which is safe related to
|
||||||
buffer overflow. Therefore, we make it the default unless HAS_VSNPRINTF
|
buffer overflow. Therefore, we make it the default unless HAS_VSNPRINTF
|
||||||
has been defined. */
|
has been defined. */
|
||||||
#ifndef HAS_VSNPRINTF
|
#ifndef HAS_VSNPRINTF
|
||||||
# define HAS_VSNPRINTF 1
|
# define HAS_VSNPRINTF 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SUPPORT_POSIX_MAPPED_FILES
|
#ifndef SUPPORT_POSIX_MAPPED_FILES
|
||||||
# define SUPPORT_POSIX_MAPPED_FILES 1
|
# define SUPPORT_POSIX_MAPPED_FILES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* `bool` is a reserved word in some but not all C++ compilers depending on age.
|
||||||
bool is a reserved word in some but
|
age. Work around is to avoid bool by introducing a new enum called `Bool`.
|
||||||
not all C++ compilers depending on age
|
|
||||||
work around is to avoid bool altogether
|
|
||||||
by introducing a new enum called Bool
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* We could use the C99 definition where supported
|
/* We could use the C99 definition where supported
|
||||||
typedef _Bool Bool;
|
typedef _Bool Bool;
|
||||||
#define no (_Bool)0
|
#define no (_Bool)0
|
||||||
|
@ -624,7 +637,7 @@ extern void* null;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(DMALLOC)
|
#if defined(DMALLOC)
|
||||||
#include "dmalloc.h"
|
# include "dmalloc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Opaque data structure.
|
/* Opaque data structure.
|
||||||
|
|
|
@ -722,7 +722,7 @@ static ctmbstr ExpandTilde( TidyDocImpl* doc, ctmbstr filename )
|
||||||
while ( *s && *s != '/' )
|
while ( *s && *s != '/' )
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
if ( t = TidyDocAlloc(doc, s - filename) )
|
if ( (t = TidyDocAlloc(doc, s - filename)) )
|
||||||
{
|
{
|
||||||
memcpy(t, filename+1, s-filename-1);
|
memcpy(t, filename+1, s-filename-1);
|
||||||
t[s-filename-1] = 0;
|
t[s-filename-1] = 0;
|
||||||
|
|
|
@ -2222,48 +2222,67 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
"Command Line Arguments for HTML Tidy:"
|
"Command Line Arguments for HTML Tidy:"
|
||||||
},
|
},
|
||||||
{/* This console output should be limited to 78 characters per line.
|
{/* This console output should be limited to 78 characters per line.
|
||||||
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */
|
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
|
||||||
|
- %s represents either a blank line, or TC_TXT_HELP_3A explaining environment options. */
|
||||||
TC_TXT_HELP_3, 0,
|
TC_TXT_HELP_3, 0,
|
||||||
"\n"
|
"\n"
|
||||||
"Tidy Configuration Options\n"
|
"Tidy Configuration Options\n"
|
||||||
"==========================\n"
|
"==========================\n"
|
||||||
"Use Tidy's configuration options as command line arguments in the form\n"
|
" Use Tidy's configuration options as command line arguments in the form\n"
|
||||||
"of \"--some-option <value>\", for example, \"--indent-with-tabs yes\".\n"
|
" of \"--some-option <value>\", for example, \"--indent-with-tabs yes\".\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For a list of all configuration options, use \"-help-config\" or refer\n"
|
" You can also specify a file containing configuration options with the \n"
|
||||||
"to the man page (if your OS has one).\n"
|
" -options <file> directive, or in one or more files specific to your \n"
|
||||||
|
" environment (see next section). \n"
|
||||||
"\n"
|
"\n"
|
||||||
"If your environment has an $HTML_TIDY variable set point to a Tidy \n"
|
" For a list of all configuration options, use \"-help-config\" or refer\n"
|
||||||
"configuration file then Tidy will attempt to use it.\n"
|
" to the man page (if your OS has one).\n"
|
||||||
"\n"
|
"\n"
|
||||||
"On some platforms Tidy will also attempt to use a configuration specified \n"
|
"Configuration Files\n"
|
||||||
"in /etc/tidy.conf or ~/.tidy.conf.\n"
|
"===================\n"
|
||||||
|
" If your environment has an $HTML_TIDY variable set to point to a Tidy \n"
|
||||||
|
" configuration file, then Tidy will attempt to use it. \n"
|
||||||
|
"%s"
|
||||||
|
" Use \"-help-env\" for more information about how you can use the environment. \n"
|
||||||
|
" to specify Tidy options. \n"
|
||||||
"\n"
|
"\n"
|
||||||
"Other\n"
|
"Other\n"
|
||||||
"=====\n"
|
"=====\n"
|
||||||
"Input/Output default to stdin/stdout respectively.\n"
|
" Input/Output default to stdin/stdout respectively.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Single letter options apart from -f may be combined\n"
|
" Single letter options apart from -f may be combined\n"
|
||||||
"as in: tidy -f errs.txt -imu foo.html\n"
|
" as in: tidy -f errs.txt -imu foo.html\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Information\n"
|
"Information\n"
|
||||||
"===========\n"
|
"===========\n"
|
||||||
"For more information about HTML Tidy, see\n"
|
" For more information about HTML Tidy, see\n"
|
||||||
" http://www.html-tidy.org/\n"
|
" http://www.html-tidy.org/\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For more information on HTML, see the following:\n"
|
" For more information on HTML, see the following:\n"
|
||||||
"\n"
|
"\n"
|
||||||
" HTML: Edition for Web Authors (the latest HTML specification)\n"
|
" HTML: Edition for Web Authors (the latest HTML specification)\n"
|
||||||
" http://dev.w3.org/html5/spec-author-view\n"
|
" http://dev.w3.org/html5/spec-author-view\n"
|
||||||
"\n"
|
"\n"
|
||||||
" HTML: The Markup Language (an HTML language reference)\n"
|
" HTML: The Markup Language (an HTML language reference)\n"
|
||||||
" http://dev.w3.org/html5/markup/\n"
|
" http://dev.w3.org/html5/markup/\n"
|
||||||
"\n"
|
"\n"
|
||||||
"File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
|
" File bug reports at https://github.com/htacg/tidy-html5/issues/\n"
|
||||||
"or send questions and comments to public-htacg@w3.org.\n"
|
" or send questions and comments to public-htacg@w3.org.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Validate your HTML documents using the W3C Nu Markup Validator:\n"
|
" Validate your HTML documents using the W3C Nu Markup Validator:\n"
|
||||||
" http://validator.w3.org/nu/\n"
|
" http://validator.w3.org/nu/\n"
|
||||||
|
"\n"
|
||||||
|
},
|
||||||
|
{/* This console output should be limited to 78 characters per line.
|
||||||
|
- The strings "Tidy" and "HTML Tidy" are the program name and must not be translated.
|
||||||
|
- Both parameters %s reflect file paths and names. */
|
||||||
|
TC_TXT_HELP_3A, 0,
|
||||||
|
"\n"
|
||||||
|
" Additionally, Tidy will automatically attempt to use configuration specified \n"
|
||||||
|
" in these files, if present: \n"
|
||||||
|
"\n"
|
||||||
|
" %s \n"
|
||||||
|
" %s \n"
|
||||||
"\n"
|
"\n"
|
||||||
},
|
},
|
||||||
{/* This console output should be limited to 78 characters per line.
|
{/* This console output should be limited to 78 characters per line.
|
||||||
|
|
Loading…
Reference in a new issue