Browse Source

CRAN fixes

tags/v0.4.0
boB Rudis 7 years ago
parent
commit
95d3534ac0
No known key found for this signature in database GPG Key ID: 2A514A4997464560
  1. 8
      .travis.yml
  2. 2
      DESCRIPTION
  3. 4
      R/RcppExports.R
  4. 2
      R/htmltidy-package.r
  5. 14
      R/tidy.r
  6. 24
      R/xmltreeview.R
  7. 45
      R/xmlview.R
  8. 15
      cran-comments.md
  9. 14
      htmltidy.Rproj
  10. 2
      man/tidy_html.Rd
  11. 27
      man/xml_tree_view.Rd
  12. 38
      man/xml_view.Rd
  13. 1
      src/Makevars
  14. 18
      src/RcppExports.cpp
  15. 544
      src/access.c
  16. 8
      src/alloc.cpp
  17. 170
      src/attrs.c
  18. 28
      src/charsets.c
  19. 102
      src/clean.c
  20. 150
      src/config.c
  21. 8
      src/entities.c
  22. 56
      src/htmltidy.cpp
  23. 22
      src/init.c
  24. 22
      src/istack.c
  25. 100
      src/lexer.c
  26. 2
      src/mappedio.c
  27. 316
      src/parser.c
  28. 152
      src/pprint.c
  29. 12
      src/streamio.c
  30. 34
      src/tags.c
  31. 58
      src/tidy.h
  32. 12
      src/tidyenum.h
  33. 66
      src/tidylib.c
  34. 36
      src/tidyplatform.h
  35. 84
      src/utf8.c
  36. 792
      src/win32tc.c

8
.travis.yml

@ -6,11 +6,3 @@ r:
- oldrel - oldrel
- release - release
- devel - devel
notifications:
email:
- bob@rud.is
irc:
channels:
- "irc.rud.is#builds"
nick: travisci

2
DESCRIPTION

@ -1,6 +1,6 @@
Package: htmltidy Package: htmltidy
Title: Tidy Up and Test XPath Queries on HTML and XML Content Title: Tidy Up and Test XPath Queries on HTML and XML Content
Version: 0.3.2 Version: 0.4.0
Encoding: UTF-8 Encoding: UTF-8
Authors@R: c( Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")), person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")),

4
R/RcppExports.R

@ -1,7 +1,7 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
tidy_html_int <- function(source, options, show_errors) { do_the_tidy <- function(source, options, show_errors) {
.Call('htmltidy_tidy_html_int', PACKAGE = 'htmltidy', source, options, show_errors) .Call(`_htmltidy_do_the_tidy`, source, options, show_errors)
} }

2
R/htmltidy-package.r

@ -19,7 +19,7 @@
#' @name htmltidy #' @name htmltidy
#' @docType package #' @docType package
#' @author Bob Rudis (bob@@rud.is) #' @author Bob Rudis (bob@@rud.is)
#' @useDynLib htmltidy, .registration=TRUE
#' @importFrom Rcpp sourceCpp #' @importFrom Rcpp sourceCpp
#' @import xml2 XML htmlwidgets htmltools #' @import xml2 XML htmlwidgets htmltools
#' @useDynLib htmltidy, .registration=TRUE
NULL NULL

14
R/tidy.r

@ -70,6 +70,7 @@
#' #'
#' cat(tidy_html(txt, option=opts)) #' cat(tidy_html(txt, option=opts))
#' #'
#' \dontrun{
#' library(httr) #' library(httr)
#' res <- GET("https://rud.is/test/untidy.html") #' res <- GET("https://rud.is/test/untidy.html")
#' #'
@ -82,6 +83,7 @@
#' #'
#' # but, you could also just do: #' # but, you could also just do:
#' cat(tidy_html(url("https://rud.is/test/untidy.html"))) #' cat(tidy_html(url("https://rud.is/test/untidy.html")))
#' }
tidy_html <- function(content, options=list(TidyXhtmlOut=TRUE), verbose=FALSE) { tidy_html <- function(content, options=list(TidyXhtmlOut=TRUE), verbose=FALSE) {
UseMethod("tidy_html") UseMethod("tidy_html")
} }
@ -91,7 +93,7 @@ tidy_html <- function(content, options=list(TidyXhtmlOut=TRUE), verbose=FALSE) {
tidy_html.default <- function(content, options=list(TidyXhtmlOut=TRUE), tidy_html.default <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) { verbose=FALSE) {
content <- paste0(content, collapse="") content <- paste0(content, collapse="")
.Call('htmltidy_tidy_html_int', PACKAGE='htmltidy', .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose) source=content, options=options, show_errors=verbose)
} }
@ -100,7 +102,7 @@ tidy_html.default <- function(content, options=list(TidyXhtmlOut=TRUE),
tidy_html.character <- function(content, options=list(TidyXhtmlOut=TRUE), tidy_html.character <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) { verbose=FALSE) {
content <- paste0(content, collapse="") content <- paste0(content, collapse="")
.Call('htmltidy_tidy_html_int', PACKAGE='htmltidy', .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose) source=content, options=options, show_errors=verbose)
} }
@ -110,7 +112,7 @@ tidy_html.raw <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) { verbose=FALSE) {
content <- content[1] content <- content[1]
content <- iconv(readBin(content, character()), to="UTF-8") content <- iconv(readBin(content, character()), to="UTF-8")
out <- .Call('htmltidy_tidy_html_int', PACKAGE='htmltidy', out <- .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose) source=content, options=options, show_errors=verbose)
charToRaw(out) charToRaw(out)
} }
@ -120,7 +122,7 @@ tidy_html.raw <- function(content, options=list(TidyXhtmlOut=TRUE),
tidy_html.xml_document <- function(content, options=list(TidyXhtmlOut=TRUE), tidy_html.xml_document <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) { verbose=FALSE) {
content <- toString(content) content <- toString(content)
out <- .Call('htmltidy_tidy_html_int', PACKAGE='htmltidy', out <- .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose) source=content, options=options, show_errors=verbose)
xml2::read_html(out) xml2::read_html(out)
} }
@ -130,7 +132,7 @@ tidy_html.xml_document <- function(content, options=list(TidyXhtmlOut=TRUE),
tidy_html.HTMLInternalDocument <- function(content, options=list(TidyXhtmlOut=TRUE), tidy_html.HTMLInternalDocument <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) { verbose=FALSE) {
content <- XML::saveXML(content) content <- XML::saveXML(content)
out <- .Call('htmltidy_tidy_html_int', PACKAGE='htmltidy', out <- .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose) source=content, options=options, show_errors=verbose)
XML::htmlParse(out) XML::htmlParse(out)
} }
@ -143,7 +145,7 @@ tidy_html.connection <- function(content, options=list(TidyXhtmlOut=TRUE),
html <- paste0(readLines(content, warn=FALSE), collapse="") html <- paste0(readLines(content, warn=FALSE), collapse="")
close(content) close(content)
.Call('htmltidy_tidy_html_int', PACKAGE='htmltidy', .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=html, options=options, show_errors=verbose) source=html, options=options, show_errors=verbose)
} }

24
R/xmltreeview.R

@ -11,7 +11,6 @@
#' Default is \code{FALSE} (take up the full viewer/browser window). If #' Default is \code{FALSE} (take up the full viewer/browser window). If
#' this is set to \code{TRUE}, \code{height} should be set to a value #' this is set to \code{TRUE}, \code{height} should be set to a value
#' other than \code{NULL}. #' other than \code{NULL}.
#' @param elementId element id
#' @param width widget \code{div} width #' @param width widget \code{div} width
#' @param height widget \code{div} height #' @param height widget \code{div} height
#' @note Large HTML or XML content may take some time to render properly. It is suggested #' @note Large HTML or XML content may take some time to render properly. It is suggested
@ -20,22 +19,12 @@
#' @export #' @export
#' @references \href{https://github.com/juliangruber/xml-viewer}{xml-viewer} #' @references \href{https://github.com/juliangruber/xml-viewer}{xml-viewer}
#' @examples #' @examples
#' if (interactive()) { #' if(interactive()) {
#' #' txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
#' # from ?xml2::read_xml #' "<body>Don't forget me this weekend!</body></note>")
#' cd <- xml2::read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml") #' # xml_tree_view(txt)
#'
#' xml_tree_view(cd)
#'
#' htmltools::browsable(
#' htmltools::tagList(
#' xml_tree_view(cd, width = "100%", height = "300px"),
#' xml_view(cd)
#' )
#' )
#' } #' }
xml_tree_view <- function(doc=NULL, scroll=FALSE, xml_tree_view <- function(doc=NULL, scroll=FALSE, width="100%", height=NULL) {
elementId=NULL, width="100%", height=NULL) {
if (inherits(doc, "character")) { if (inherits(doc, "character")) {
doc <- paste0(doc, collapse="") doc <- paste0(doc, collapse="")
@ -59,8 +48,7 @@ xml_tree_view <- function(doc=NULL, scroll=FALSE,
x = params, x = params,
width = width, width = width,
height = height, height = height,
package = 'htmltidy', package = 'htmltidy'
elementId = elementId
) )
} }

45
R/xmlview.R

@ -17,7 +17,6 @@
#' @param apply_xpath Add and apply an XPath query string to the view. If #' @param apply_xpath Add and apply an XPath query string to the view. If
#' \code{add_filter} is \code{TRUE} then this query string will #' \code{add_filter} is \code{TRUE} then this query string will
#' appear in the filter box and be applied to the passed in document. #' appear in the filter box and be applied to the passed in document.
#' @param elementId element id
#' @param width widget width (best to keep it at 100\%) #' @param width widget width (best to keep it at 100\%)
#' @param height widget height (kinda only useful for knitting since this is #' @param height widget height (kinda only useful for knitting since this is
#' meant to be an interactive tool). #' meant to be an interactive tool).
@ -29,43 +28,12 @@
#' \href{http://www.eslinstructor.net/vkbeautify/}{vkbeautify} #' \href{http://www.eslinstructor.net/vkbeautify/}{vkbeautify}
#' @examples #' @examples
#' if (interactive()) { #' if (interactive()) {
#' library(xml2)
#'
#' # plain text
#' txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>", #' txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
#' "<body>Don't forget me this weekend!</body></note>") #' "<body>Don't forget me this weekend!</body></note>")
#' xml_view(txt) #' # xml_view(txt)
#'
#' # xml object
#' doc <- read_xml(txt)
#' xml_view(doc, style="obsidian")
#'
#' # different style
#' xml_view(xml_find_all(doc, ".//to"), style="github-gist")
#'
#' # some more complex daata
#' xml_view(read_xml(system.file("extdata/dwml.xml", package="htmltidy")))
#' xml_view(read_xml(system.file("extdata/getHistory.xml", package="htmltidy")),
#' "androidstudio")
#' xml_view(read_xml(system.file("extdata/input.xml", package="htmltidy")),
#' "sunburst")
#'
#' # filter + apply an initial XPath query string
#' xml_view(read_xml(system.file("extdata/dwml.xml", package="xmlview")),
#' add_filter=TRUE, apply_xpath=".//temperature")
#'
#' doc <- read_xml("http://www.npr.org/rss/rss.php?id=1001")
#'
#' str(doc)
#'
#' xml_view(doc, add_filter=TRUE)
#' xml2::xml_find_all(doc, './/dc:creator', ns=xml2::xml_ns(doc))
#'
#' xml_text(xml2::xml_find_all(doc, './/link[contains(., "soccer")]', ns=xml2::xml_ns(doc)))
#' } #' }
xml_view <- function(doc, style="default", scroll=FALSE, add_filter=FALSE, xml_view <- function(doc, style="default", scroll=FALSE, add_filter=FALSE,
apply_xpath=NULL, elementId=NULL, apply_xpath = NULL, width="100%", height=NULL) {
width="100%", height=NULL) {
xml_doc_name <- "doc" xml_doc_name <- "doc"
@ -94,17 +62,16 @@ xml_view <- function(doc, style="default", scroll=FALSE, add_filter=FALSE,
styleSheet = style, styleSheet = style,
addFilter = add_filter, addFilter = add_filter,
applyXPath = apply_xpath, applyXPath = apply_xpath,
scroll=scroll, scroll = scroll,
xmlDocName=xml_doc_name xmlDocName = xml_doc_name
) )
htmlwidgets::createWidget( htmlwidgets::createWidget(
name = 'xmlview', name = 'xmlview',
params, x = params,
width = width, width = width,
height = height, height = height,
package = 'htmltidy', package = 'htmltidy'
elementId = elementId
) )
} }

15
cran-comments.md

@ -1,15 +1,20 @@
## Test environments ## Test environments
* local OS X install, R 3.3.2 (clang) * local OS X install, R 3.4.1 (clang)
* ubuntu 12.04 (on travis-ci), oldrel, release & devel * ubuntu 14.04 (on travis-ci), oldrel, release & devel
* win-builder (devel and release) * win-builder (devel and release)
* AppVeyor * AppVeyor
## R CMD check results ## R CMD check results
0 errors | 0 warnings | 1 notes (names) 0 errors | 0 warnings | 0 notes
--- ---
Fix per note from CRAN regarding checks tossing warnings Fix per note from CRAN regarding
due to URL redirection. checks failing, htmltidy C[++]
code has been updated and examples
that required internet access to
successfully complete have been
re-worked to use the system.file()
package exmaple files.

14
htmltidy.Rproj

@ -5,21 +5,19 @@ SaveWorkspace: No
AlwaysSaveHistory: Default AlwaysSaveHistory: Default
EnableCodeIndexing: Yes EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8 Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes AutoAppendNewline: Yes
StripTrailingWhitespace: Yes StripTrailingWhitespace: Yes
BuildType: Package BuildType: Package
PackageUseDevtools: Yes PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
UseSpacesForTab: Yes
NumSpacesForTab: 2
RnwWeave: Sweave
LaTeX: pdfLaTeX
PackageBuildArgs: --resave-data PackageBuildArgs: --resave-data
PackageCheckArgs: --as-cran PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace

2
man/tidy_html.Rd

@ -109,6 +109,7 @@ txt <- paste0(
cat(tidy_html(txt, option=opts)) cat(tidy_html(txt, option=opts))
\dontrun{
library(httr) library(httr)
res <- GET("https://rud.is/test/untidy.html") res <- GET("https://rud.is/test/untidy.html")
@ -122,6 +123,7 @@ cat(tidy_html(content(res, as="text", encoding="UTF-8"),
# but, you could also just do: # but, you could also just do:
cat(tidy_html(url("https://rud.is/test/untidy.html"))) cat(tidy_html(url("https://rud.is/test/untidy.html")))
} }
}
\references{ \references{
\url{http://api.html-tidy.org/tidy/quickref_5.1.25.html} & \url{http://api.html-tidy.org/tidy/quickref_5.1.25.html} &
\url{https://github.com/htacg/tidy-html5/blob/master/include/tidyenum.h} \url{https://github.com/htacg/tidy-html5/blob/master/include/tidyenum.h}

27
man/xml_tree_view.Rd

@ -5,11 +5,11 @@
\alias{html_tree_view} \alias{html_tree_view}
\title{HTML/XML tree viewer} \title{HTML/XML tree viewer}
\usage{ \usage{
xml_tree_view(doc = NULL, scroll = FALSE, elementId = NULL, xml_tree_view(doc = NULL, scroll = FALSE, width = "100\%",
width = "100\%", height = NULL) height = NULL)
html_tree_view(doc = NULL, scroll = FALSE, elementId = NULL, html_tree_view(doc = NULL, scroll = FALSE, width = "100\%",
width = "100\%", height = NULL) height = NULL)
} }
\arguments{ \arguments{
\item{doc}{\code{xml2} document/node/nodeset, an \code{HTMLInternalDocument}/ \item{doc}{\code{xml2} document/node/nodeset, an \code{HTMLInternalDocument}/
@ -21,8 +21,6 @@ Default is \code{FALSE} (take up the full viewer/browser window). If
this is set to \code{TRUE}, \code{height} should be set to a value this is set to \code{TRUE}, \code{height} should be set to a value
other than \code{NULL}.} other than \code{NULL}.}
\item{elementId}{element id}
\item{width}{widget \code{div} width} \item{width}{widget \code{div} width}
\item{height}{widget \code{div} height} \item{height}{widget \code{div} height}
@ -38,19 +36,10 @@ Large HTML or XML content may take some time to render properly. It is suggested
or used in a browser context vs an IDE viewer context. or used in a browser context vs an IDE viewer context.
} }
\examples{ \examples{
if (interactive()) { if(interactive()) {
txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
# from ?xml2::read_xml "<body>Don't forget me this weekend!</body></note>")
cd <- xml2::read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml") # xml_tree_view(txt)
xml_tree_view(cd)
htmltools::browsable(
htmltools::tagList(
xml_tree_view(cd, width = "100\%", height = "300px"),
xml_view(cd)
)
)
} }
} }
\references{ \references{

38
man/xml_view.Rd

@ -6,10 +6,10 @@
\title{HTML/XML pretty printer and viewer} \title{HTML/XML pretty printer and viewer}
\usage{ \usage{
xml_view(doc, style = "default", scroll = FALSE, add_filter = FALSE, xml_view(doc, style = "default", scroll = FALSE, add_filter = FALSE,
apply_xpath = NULL, elementId = NULL, width = "100\%", height = NULL) apply_xpath = NULL, width = "100\%", height = NULL)
html_view(doc, style = "default", scroll = FALSE, add_filter = FALSE, html_view(doc, style = "default", scroll = FALSE, add_filter = FALSE,
apply_xpath = NULL, elementId = NULL, width = "100\%", height = NULL) apply_xpath = NULL, width = "100\%", height = NULL)
} }
\arguments{ \arguments{
\item{doc}{\code{xml2} document/node/nodeset, an \code{HTMLInternalDocument}/ \item{doc}{\code{xml2} document/node/nodeset, an \code{HTMLInternalDocument}/
@ -30,8 +30,6 @@ other than \code{NULL}.}
\code{add_filter} is \code{TRUE} then this query string will \code{add_filter} is \code{TRUE} then this query string will
appear in the filter box and be applied to the passed in document.} appear in the filter box and be applied to the passed in document.}
\item{elementId}{element id}
\item{width}{widget width (best to keep it at 100\%)} \item{width}{widget width (best to keep it at 100\%)}
\item{height}{widget height (kinda only useful for knitting since this is \item{height}{widget height (kinda only useful for knitting since this is
@ -49,39 +47,9 @@ Large HTML or XML content may take some time to render properly. It is suggested
} }
\examples{ \examples{
if (interactive()) { if (interactive()) {
library(xml2)
# plain text
txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>", txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
"<body>Don't forget me this weekend!</body></note>") "<body>Don't forget me this weekend!</body></note>")
xml_view(txt) # xml_view(txt)
# xml object
doc <- read_xml(txt)
xml_view(doc, style="obsidian")
# different style
xml_view(xml_find_all(doc, ".//to"), style="github-gist")
# some more complex daata
xml_view(read_xml(system.file("extdata/dwml.xml", package="htmltidy")))
xml_view(read_xml(system.file("extdata/getHistory.xml", package="htmltidy")),
"androidstudio")
xml_view(read_xml(system.file("extdata/input.xml", package="htmltidy")),
"sunburst")
# filter + apply an initial XPath query string
xml_view(read_xml(system.file("extdata/dwml.xml", package="xmlview")),
add_filter=TRUE, apply_xpath=".//temperature")
doc <- read_xml("http://www.npr.org/rss/rss.php?id=1001")
str(doc)
xml_view(doc, add_filter=TRUE)
xml2::xml_find_all(doc, './/dc:creator', ns=xml2::xml_ns(doc))
xml_text(xml2::xml_find_all(doc, './/link[contains(., "soccer")]', ns=xml2::xml_ns(doc)))
} }
} }
\references{ \references{

1
src/Makevars

@ -1,2 +1,3 @@
PKG_CPPFLAGS = -I. PKG_CPPFLAGS = -I.
PKG_CXXFLAGS = -I. PKG_CXXFLAGS = -I.
PKG_LIBS = -L.

18
src/RcppExports.cpp

@ -5,16 +5,26 @@
using namespace Rcpp; using namespace Rcpp;
// tidy_html_int // do_the_tidy
Rcpp::CharacterVector tidy_html_int(std::string source, Rcpp::List options, bool show_errors); Rcpp::CharacterVector do_the_tidy(std::string source, Rcpp::List options, bool show_errors);
RcppExport SEXP htmltidy_tidy_html_int(SEXP sourceSEXP, SEXP optionsSEXP, SEXP show_errorsSEXP) { RcppExport SEXP _htmltidy_do_the_tidy(SEXP sourceSEXP, SEXP optionsSEXP, SEXP show_errorsSEXP) {
BEGIN_RCPP BEGIN_RCPP
Rcpp::RObject rcpp_result_gen; Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< std::string >::type source(sourceSEXP); Rcpp::traits::input_parameter< std::string >::type source(sourceSEXP);
Rcpp::traits::input_parameter< Rcpp::List >::type options(optionsSEXP); Rcpp::traits::input_parameter< Rcpp::List >::type options(optionsSEXP);
Rcpp::traits::input_parameter< bool >::type show_errors(show_errorsSEXP); Rcpp::traits::input_parameter< bool >::type show_errors(show_errorsSEXP);
rcpp_result_gen = Rcpp::wrap(tidy_html_int(source, options, show_errors)); rcpp_result_gen = Rcpp::wrap(do_the_tidy(source, options, show_errors));
return rcpp_result_gen; return rcpp_result_gen;
END_RCPP END_RCPP
} }
static const R_CallMethodDef CallEntries[] = {
{"_htmltidy_do_the_tidy", (DL_FUNC) &_htmltidy_do_the_tidy, 3},
{NULL, NULL, 0}
};
RcppExport void R_init_htmltidy(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}

544
src/access.c

File diff suppressed because it is too large

8
src/alloc.cpp

@ -25,22 +25,22 @@ static TidyPanic g_panic = NULL;
Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc ) Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc )
{ {
g_malloc = fmalloc; g_malloc = fmalloc;
return yes; return aye;
} }
Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc ) Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc )
{ {
g_realloc = frealloc; g_realloc = frealloc;
return yes; return aye;
} }
Bool TIDY_CALL tidySetFreeCall( TidyFree ffree ) Bool TIDY_CALL tidySetFreeCall( TidyFree ffree )
{ {
g_free = ffree; g_free = ffree;
return yes; return aye;
} }
Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic ) Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic )
{ {
g_panic = fpanic; g_panic = fpanic;
return yes; return aye;
} }
static void TIDY_CALL defaultPanic( TidyAllocator* ARG_UNUSED(allocator), ctmbstr msg ) static void TIDY_CALL defaultPanic( TidyAllocator* ARG_UNUSED(allocator), ctmbstr msg )

170
src/attrs.c

@ -96,43 +96,43 @@ static AttrCheck CheckRDFaPrefix;
static const Attribute attribute_defs [] = static const Attribute attribute_defs [] =
{ {
{ TidyAttr_UNKNOWN, "unknown!", NULL }, { TidyAttr_UNKNOWN, "unknown!", NULL },
{ TidyAttr_ABBR, "abbr", CH_PCDATA }, { TidyAttr_ABBR, "abbr", CH_PCDATA },
{ TidyAttr_ACCEPT, "accept", CH_XTYPE }, { TidyAttr_ACCEPT, "accept", CH_XTYPE },
{ TidyAttr_ACCEPT_CHARSET, "accept-charset", CH_CHARSET }, { TidyAttr_ACCEPT_CHARSET, "accept-charset", CH_CHARSET },
{ TidyAttr_ACCESSKEY, "accesskey", CH_CHARACTER }, { TidyAttr_ACCESSKEY, "accesskey", CH_CHARACTER },
{ TidyAttr_ACTION, "action", CH_ACTION }, { TidyAttr_ACTION, "action", CH_ACTION },
{ TidyAttr_ADD_DATE, "add_date", CH_PCDATA }, /* A */ { TidyAttr_ADD_DATE, "add_date", CH_PCDATA }, /* A */
{ TidyAttr_ALIGN, "align", CH_ALIGN }, /* varies by element */ { TidyAttr_ALIGN, "align", CH_ALIGN }, /* varies by element */
{ TidyAttr_ALINK, "alink", CH_COLOR }, { TidyAttr_ALINK, "alink", CH_COLOR },
{ TidyAttr_ALLOWFULLSCREEN, "allowfullscreen", CH_BOOL }, { TidyAttr_ALLOWFULLSCREEN, "allowfullscreen", CH_BOOL },
{ TidyAttr_ALT, "alt", CH_PCDATA }, /* nowrap */ { TidyAttr_ALT, "alt", CH_PCDATA }, /* nowrap */
{ TidyAttr_ARCHIVE, "archive", CH_URLS }, /* space or comma separated list */ { TidyAttr_ARCHIVE, "archive", CH_URLS }, /* space or comma separated list */
{ TidyAttr_AXIS, "axis", CH_PCDATA }, { TidyAttr_AXIS, "axis", CH_PCDATA },
{ TidyAttr_BACKGROUND, "background", CH_URL }, { TidyAttr_BACKGROUND, "background", CH_URL },
{ TidyAttr_BGCOLOR, "bgcolor", CH_COLOR }, { TidyAttr_BGCOLOR, "bgcolor", CH_COLOR },
{ TidyAttr_BGPROPERTIES, "bgproperties", CH_PCDATA }, /* BODY "fixed" fixes background */ { TidyAttr_BGPROPERTIES, "bgproperties", CH_PCDATA }, /* BODY "fixed" fixes background */
{ TidyAttr_BORDER, "border", CH_BORDER }, /* like LENGTH + "border" */ { TidyAttr_BORDER, "border", CH_BORDER }, /* like LENGTH + "border" */
{ TidyAttr_BORDERCOLOR, "bordercolor", CH_COLOR }, /* used on TABLE */ { TidyAttr_BORDERCOLOR, "bordercolor", CH_COLOR }, /* used on TABLE */
{ TidyAttr_BOTTOMMARGIN, "bottommargin", CH_NUMBER }, /* used on BODY */ { TidyAttr_BOTTOMMARGIN, "bottommargin", CH_NUMBER }, /* used on BODY */
{ TidyAttr_CELLPADDING, "cellpadding", CH_LENGTH }, /* % or pixel values */ { TidyAttr_CELLPADDING, "cellpadding", CH_LENGTH }, /* % or pixel values */
{ TidyAttr_CELLSPACING, "cellspacing", CH_LENGTH }, { TidyAttr_CELLSPACING, "cellspacing", CH_LENGTH },
{ TidyAttr_CHAR, "char", CH_CHARACTER }, { TidyAttr_CHAR, "char", CH_CHARACTER },
{ TidyAttr_CHAROFF, "charoff", CH_LENGTH }, { TidyAttr_CHAROFF, "charoff", CH_LENGTH },
{ TidyAttr_CHARSET, "charset", CH_CHARSET }, { TidyAttr_CHARSET, "charset", CH_CHARSET },
{ TidyAttr_CHECKED, "checked", CH_BOOL }, /* i.e. "checked" or absent */ { TidyAttr_CHECKED, "checked", CH_BOOL }, /* i.e. "checked" or absent */
{ TidyAttr_CITE, "cite", CH_URL }, { TidyAttr_CITE, "cite", CH_URL },
{ TidyAttr_CLASS, "class", CH_PCDATA }, { TidyAttr_CLASS, "class", CH_PCDATA },
{ TidyAttr_CLASSID, "classid", CH_URL }, { TidyAttr_CLASSID, "classid", CH_URL },
{ TidyAttr_CLEAR, "clear", CH_CLEAR }, /* BR: left, right, all */ { TidyAttr_CLEAR, "clear", CH_CLEAR }, /* BR: left, right, all */
{ TidyAttr_CODE, "code", CH_PCDATA }, /* APPLET */ { TidyAttr_CODE, "code", CH_PCDATA }, /* APPLET */
{ TidyAttr_CODEBASE, "codebase", CH_URL }, /* OBJECT */ { TidyAttr_CODEBASE, "codebase", CH_URL }, /* OBJECT */
{ TidyAttr_CODETYPE, "codetype", CH_XTYPE }, /* OBJECT */ { TidyAttr_CODETYPE, "codetype", CH_XTYPE }, /* OBJECT */
{ TidyAttr_COLOR, "color", CH_COLOR }, /* BASEFONT, FONT */ { TidyAttr_COLOR, "color", CH_COLOR }, /* BASEFONT, FONT */
{ TidyAttr_COLS, "cols", CH_COLS }, /* TABLE & FRAMESET */ { TidyAttr_COLS, "cols", CH_COLS }, /* TABLE & FRAMESET */
{ TidyAttr_COLSPAN, "colspan", CH_NUMBER }, { TidyAttr_COLSPAN, "colspan", CH_NUMBER },
{ TidyAttr_COMPACT, "compact", CH_BOOL }, /* lists */ { TidyAttr_COMPACT, "compact", CH_BOOL }, /* lists */
{ TidyAttr_CONTENT, "content", CH_PCDATA }, { TidyAttr_CONTENT, "content", CH_PCDATA },
{ TidyAttr_COORDS, "coords", CH_COORDS }, /* AREA, A */ { TidyAttr_COORDS, "coords", CH_COORDS }, /* AREA, A */
{ TidyAttr_DATA, "data", CH_URL }, /* OBJECT */ { TidyAttr_DATA, "data", CH_URL }, /* OBJECT */
{ TidyAttr_DATAFLD, "datafld", CH_PCDATA }, /* used on DIV, IMG */ { TidyAttr_DATAFLD, "datafld", CH_PCDATA }, /* used on DIV, IMG */
@ -150,7 +150,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_FOR, "for", CH_IDREF }, /* LABEL */ { TidyAttr_FOR, "for", CH_IDREF }, /* LABEL */
{ TidyAttr_FRAME, "frame", CH_TFRAME }, /* TABLE */ { TidyAttr_FRAME, "frame", CH_TFRAME }, /* TABLE */
{ TidyAttr_FRAMEBORDER, "frameborder", CH_FBORDER }, /* 0 or 1 */ { TidyAttr_FRAMEBORDER, "frameborder", CH_FBORDER }, /* 0 or 1 */
{ TidyAttr_FRAMESPACING, "framespacing", CH_NUMBER }, { TidyAttr_FRAMESPACING, "framespacing", CH_NUMBER },
{ TidyAttr_GRIDX, "gridx", CH_NUMBER }, /* TABLE Adobe golive*/ { TidyAttr_GRIDX, "gridx", CH_NUMBER }, /* TABLE Adobe golive*/
{ TidyAttr_GRIDY, "gridy", CH_NUMBER }, /* TABLE Adobe golive */ { TidyAttr_GRIDY, "gridy", CH_NUMBER }, /* TABLE Adobe golive */
{ TidyAttr_HEADERS, "headers", CH_IDREFS }, /* table cells */ { TidyAttr_HEADERS, "headers", CH_IDREFS }, /* table cells */
@ -159,7 +159,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_HREFLANG, "hreflang", CH_LANG }, /* A, LINK */ { TidyAttr_HREFLANG, "hreflang", CH_LANG }, /* A, LINK */
{ TidyAttr_HSPACE, "hspace", CH_NUMBER }, /* APPLET, IMG, OBJECT */ { TidyAttr_HSPACE, "hspace", CH_NUMBER }, /* APPLET, IMG, OBJECT */
{ TidyAttr_HTTP_EQUIV, "http-equiv", CH_PCDATA }, /* META */ { TidyAttr_HTTP_EQUIV, "http-equiv", CH_PCDATA }, /* META */
{ TidyAttr_ID, "id", CH_IDDEF }, { TidyAttr_ID, "id", CH_IDDEF },
{ TidyAttr_ISMAP, "ismap", CH_BOOL }, /* IMG */ { TidyAttr_ISMAP, "ismap", CH_BOOL }, /* IMG */
{ TidyAttr_ITEMID, "itemid", CH_PCDATA }, { TidyAttr_ITEMID, "itemid", CH_PCDATA },
{ TidyAttr_ITEMPROP, "itemprop", CH_PCDATA }, { TidyAttr_ITEMPROP, "itemprop", CH_PCDATA },
@ -167,7 +167,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_ITEMSCOPE, "itemscope", CH_BOOL }, { TidyAttr_ITEMSCOPE, "itemscope", CH_BOOL },
{ TidyAttr_ITEMTYPE, "itemtype", CH_URL }, { TidyAttr_ITEMTYPE, "itemtype", CH_URL },
{ TidyAttr_LABEL, "label", CH_PCDATA }, /* OPT, OPTGROUP */ { TidyAttr_LABEL, "label", CH_PCDATA }, /* OPT, OPTGROUP */
{ TidyAttr_LANG, "lang", CH_LANG }, { TidyAttr_LANG, "lang", CH_LANG },
{ TidyAttr_LANGUAGE, "language", CH_PCDATA }, /* SCRIPT */ { TidyAttr_LANGUAGE, "language", CH_PCDATA }, /* SCRIPT */
{ TidyAttr_LAST_MODIFIED, "last_modified", CH_PCDATA }, /* A */ { TidyAttr_LAST_MODIFIED, "last_modified", CH_PCDATA }, /* A */
{ TidyAttr_LAST_VISIT, "last_visit", CH_PCDATA }, /* A */ { TidyAttr_LAST_VISIT, "last_visit", CH_PCDATA }, /* A */
@ -181,21 +181,21 @@ static const Attribute attribute_defs [] =
{ TidyAttr_MEDIA, "media", CH_MEDIA }, /* STYLE, LINK */ { TidyAttr_MEDIA, "media", CH_MEDIA }, /* STYLE, LINK */
{ TidyAttr_METHOD, "method", CH_FSUBMIT }, /* FORM: get or post */ { TidyAttr_METHOD, "method", CH_FSUBMIT }, /* FORM: get or post */
{ TidyAttr_MULTIPLE, "multiple", CH_BOOL }, /* SELECT */ { TidyAttr_MULTIPLE, "multiple", CH_BOOL }, /* SELECT */
{ TidyAttr_NAME, "name", CH_NAME }, { TidyAttr_NAME, "name", CH_NAME },
{ TidyAttr_NOHREF, "nohref", CH_BOOL }, /* AREA */ { TidyAttr_NOHREF, "nohref", CH_BOOL }, /* AREA */
{ TidyAttr_NORESIZE, "noresize", CH_BOOL }, /* FRAME */ { TidyAttr_NORESIZE, "noresize", CH_BOOL }, /* FRAME */
{ TidyAttr_NOSHADE, "noshade", CH_BOOL }, /* HR */ { TidyAttr_NOSHADE, "noshade", CH_BOOL }, /* HR */
{ TidyAttr_NOWRAP, "nowrap", CH_BOOL }, /* table cells */ { TidyAttr_NOWRAP, "nowrap", CH_BOOL }, /* table cells */
{ TidyAttr_OBJECT, "object", CH_PCDATA }, /* APPLET */ { TidyAttr_OBJECT, "object", CH_PCDATA }, /* APPLET */
{ TidyAttr_OnAFTERUPDATE, "onafterupdate", CH_SCRIPT }, { TidyAttr_OnAFTERUPDATE, "onafterupdate", CH_SCRIPT },
{ TidyAttr_OnBEFOREUNLOAD, "onbeforeunload", CH_SCRIPT }, { TidyAttr_OnBEFOREUNLOAD, "onbeforeunload", CH_SCRIPT },
{ TidyAttr_OnBEFOREUPDATE, "onbeforeupdate", CH_SCRIPT }, { TidyAttr_OnBEFOREUPDATE, "onbeforeupdate", CH_SCRIPT },
{ TidyAttr_OnBLUR, "onblur", CH_SCRIPT }, /* event */ { TidyAttr_OnBLUR, "onblur", CH_SCRIPT }, /* event */
{ TidyAttr_OnCHANGE, "onchange", CH_SCRIPT }, /* event */ { TidyAttr_OnCHANGE, "onchange", CH_SCRIPT }, /* event */
{ TidyAttr_OnCLICK, "onclick", CH_SCRIPT }, /* event */ { TidyAttr_OnCLICK, "onclick", CH_SCRIPT }, /* event */
{ TidyAttr_OnDATAAVAILABLE, "ondataavailable", CH_SCRIPT }, /* object, applet */ { TidyAttr_OnDATAAVAILABLE, "ondataavailable", CH_SCRIPT }, /* object, applet */
{ TidyAttr_OnDATASETCHANGED, "ondatasetchanged", CH_SCRIPT }, /* object, applet */ { TidyAttr_OnDATASETCHANGED, "ondatasetchanged", CH_SCRIPT }, /* object, applet */
{ TidyAttr_OnDATASETCOMPLETE, "ondatasetcomplete", CH_SCRIPT }, { TidyAttr_OnDATASETCOMPLETE, "ondatasetcomplete", CH_SCRIPT },
{ TidyAttr_OnDBLCLICK, "ondblclick", CH_SCRIPT }, /* event */ { TidyAttr_OnDBLCLICK, "ondblclick", CH_SCRIPT }, /* event */
{ TidyAttr_OnERRORUPDATE, "onerrorupdate", CH_SCRIPT }, /* form fields */ { TidyAttr_OnERRORUPDATE, "onerrorupdate", CH_SCRIPT }, /* form fields */
{ TidyAttr_OnFOCUS, "onfocus", CH_SCRIPT }, /* event */ { TidyAttr_OnFOCUS, "onfocus", CH_SCRIPT }, /* event */
@ -218,8 +218,8 @@ static const Attribute attribute_defs [] =
{ TidyAttr_PROMPT, "prompt", CH_PCDATA }, /* ISINDEX */ { TidyAttr_PROMPT, "prompt", CH_PCDATA }, /* ISINDEX */
{ TidyAttr_RBSPAN, "rbspan", CH_NUMBER }, /* ruby markup */ { TidyAttr_RBSPAN, "rbspan", CH_NUMBER }, /* ruby markup */
{ TidyAttr_READONLY, "readonly", CH_BOOL }, /* form fields */ { TidyAttr_READONLY, "readonly", CH_BOOL }, /* form fields */
{ TidyAttr_REL, "rel", CH_LINKTYPES }, { TidyAttr_REL, "rel", CH_LINKTYPES },
{ TidyAttr_REV, "rev", CH_LINKTYPES }, { TidyAttr_REV, "rev", CH_LINKTYPES },
{ TidyAttr_RIGHTMARGIN, "rightmargin", CH_NUMBER }, /* used on BODY */ { TidyAttr_RIGHTMARGIN, "rightmargin", CH_NUMBER }, /* used on BODY */
{ TidyAttr_ROLE, "role", CH_PCDATA }, { TidyAttr_ROLE, "role", CH_PCDATA },
{ TidyAttr_ROWS, "rows", CH_NUMBER }, /* TEXTAREA */ { TidyAttr_ROWS, "rows", CH_NUMBER }, /* TEXTAREA */
@ -227,7 +227,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_RULES, "rules", CH_TRULES }, /* TABLE */ { TidyAttr_RULES, "rules", CH_TRULES }, /* TABLE */
{ TidyAttr_SCHEME, "scheme", CH_PCDATA }, /* META */ { TidyAttr_SCHEME, "scheme", CH_PCDATA }, /* META */
{ TidyAttr_SCOPE, "scope", CH_SCOPE }, /* table cells */ { TidyAttr_SCOPE, "scope", CH_SCOPE }, /* table cells */
{ TidyAttr_SCROLLING, "scrolling", CH_SCROLL }, /* yes, no or auto */ { TidyAttr_SCROLLING, "scrolling", CH_SCROLL }, /* aye, no or auto */
{ TidyAttr_SELECTED, "selected", CH_BOOL }, /* OPTION */ { TidyAttr_SELECTED, "selected", CH_BOOL }, /* OPTION */
{ TidyAttr_SHAPE, "shape", CH_SHAPE }, /* AREA, A */ { TidyAttr_SHAPE, "shape", CH_SHAPE }, /* AREA, A */
{ TidyAttr_SHOWGRID, "showgrid", CH_BOOL }, /* TABLE Adobe golive */ { TidyAttr_SHOWGRID, "showgrid", CH_BOOL }, /* TABLE Adobe golive */
@ -239,7 +239,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_SRCSET, "srcset", CH_PCDATA }, /* IMG (HTML5) */ { TidyAttr_SRCSET, "srcset", CH_PCDATA }, /* IMG (HTML5) */
{ TidyAttr_STANDBY, "standby", CH_PCDATA }, /* OBJECT */ { TidyAttr_STANDBY, "standby", CH_PCDATA }, /* OBJECT */
{ TidyAttr_START, "start", CH_NUMBER }, /* OL */ { TidyAttr_START, "start", CH_NUMBER }, /* OL */
{ TidyAttr_STYLE, "style", CH_PCDATA }, { TidyAttr_STYLE, "style", CH_PCDATA },
{ TidyAttr_SUMMARY, "summary", CH_PCDATA }, /* TABLE */ { TidyAttr_SUMMARY, "summary", CH_PCDATA }, /* TABLE */
{ TidyAttr_TABINDEX, "tabindex", CH_NUMBER }, /* fields, OBJECT and A */ { TidyAttr_TABINDEX, "tabindex", CH_NUMBER }, /* fields, OBJECT and A */
{ TidyAttr_TARGET, "target", CH_TARGET }, /* names a frame/window */ { TidyAttr_TARGET, "target", CH_TARGET }, /* names a frame/window */
@ -249,8 +249,8 @@ static const Attribute attribute_defs [] =
{ TidyAttr_TRANSLATE, "translate", CH_BOOL }, /* HTML5 global attribute */ { TidyAttr_TRANSLATE, "translate", CH_BOOL }, /* HTML5 global attribute */
{ TidyAttr_TYPE, "type", CH_TYPE }, /* also used by SPACER */ { TidyAttr_TYPE, "type", CH_TYPE }, /* also used by SPACER */
{ TidyAttr_USEMAP, "usemap", CH_URL }, /* things with images */ { TidyAttr_USEMAP, "usemap", CH_URL }, /* things with images */
{ TidyAttr_VALIGN, "valign", CH_VALIGN }, { TidyAttr_VALIGN, "valign", CH_VALIGN },
{ TidyAttr_VALUE, "value", CH_PCDATA }, { TidyAttr_VALUE, "value", CH_PCDATA },
{ TidyAttr_VALUETYPE, "valuetype", CH_VTYPE }, /* PARAM: data, ref, object */ { TidyAttr_VALUETYPE, "valuetype", CH_VTYPE }, /* PARAM: data, ref, object */
{ TidyAttr_VERSION, "version", CH_PCDATA }, /* HTML <?xml?> */ { TidyAttr_VERSION, "version", CH_PCDATA }, /* HTML <?xml?> */
{ TidyAttr_VLINK, "vlink", CH_COLOR }, /* BODY */ { TidyAttr_VLINK, "vlink", CH_COLOR }, /* BODY */
@ -501,7 +501,7 @@ Bool TY_(AttributeIsProprietary)(Node* node, AttVal* attval)
if (AttributeVersions(node, attval) & VERS_ALL) if (AttributeVersions(node, attval) & VERS_ALL)
return no; return no;
return yes; return aye;
} }
/* returns true if the element is a W3C defined element /* returns true if the element is a W3C defined element
@ -513,13 +513,13 @@ Bool TY_(AttributeIsProprietary)(Node* node, AttVal* attval)
Bool TY_(AttributeIsMismatched)(Node* node, AttVal* attval, TidyDocImpl* doc) Bool TY_(AttributeIsMismatched)(Node* node, AttVal* attval, TidyDocImpl* doc)
{ {
uint doctype; uint doctype;
if (!node || !attval) if (!node || !attval)
return no; return no;
if (!node->tag) if (!node->tag)
return no; return no;
if (!(node->tag->versions & VERS_ALL)) if (!(node->tag->versions & VERS_ALL))
return no; return no;
@ -527,8 +527,8 @@ Bool TY_(AttributeIsMismatched)(Node* node, AttVal* attval, TidyDocImpl* doc)
if (AttributeVersions(node, attval) & doctype) if (AttributeVersions(node, attval) & doctype)
return no; return no;
return yes; return aye;
} }
@ -770,7 +770,7 @@ static void attrsRemoveFromHash( TidyDocImpl* doc, TidyAttribImpl *attribs,
{ {
AttrHash* next = p->next; AttrHash* next = p->next;
if ( prev ) if ( prev )
prev->next = next; prev->next = next;
else else
attribs->hashtab[h] = next; attribs->hashtab[h] = next;
TidyDocFree(doc, p); TidyDocFree(doc, p);
@ -877,7 +877,7 @@ void TY_(DropAttrByName)( TidyDocImpl* doc, Node *node, ctmbstr name )
else else
node->attributes = next; node->attributes = next;
TY_(FreeAttribute)( doc, attr ); TY_(FreeAttribute)( doc, attr );
break; break;
} }
} }
@ -955,7 +955,7 @@ Bool TY_(IsAnchorElement)( TidyDocImpl* ARG_UNUSED(doc), Node* node)
tid == TidyTag_IFRAME || tid == TidyTag_IFRAME ||
tid == TidyTag_IMG || tid == TidyTag_IMG ||
tid == TidyTag_MAP ) tid == TidyTag_MAP )
return yes; return aye;
return no; return no;
} }
@ -976,7 +976,7 @@ Bool TY_(IsAnchorElement)( TidyDocImpl* ARG_UNUSED(doc), Node* node)
*/ */
Bool TY_(IsCSS1Selector)( ctmbstr buf ) Bool TY_(IsCSS1Selector)( ctmbstr buf )
{ {
Bool valid = yes; Bool valid = aye;
int esclen = 0; int esclen = 0;
byte c; byte c;
int pos; int pos;
@ -1021,7 +1021,7 @@ static uint anchorNameHash(ctmbstr s)
{ {
uint hashval = 0; uint hashval = 0;
/* Issue #149 - an inferred name can be null. avoid crash */ /* Issue #149 - an inferred name can be null. avoid crash */
if (s) if (s)
{ {
for ( ; *s != '\0'; s++) { for ( ; *s != '\0'; s++) {
tmbchar c = TY_(ToLower)( *s ); tmbchar c = TY_(ToLower)( *s );
@ -1040,7 +1040,7 @@ static uint anchorNameHash5(ctmbstr s)
{ {
uint hashval = 0; uint hashval = 0;
/* Issue #149 - an inferred name can be null. avoid crash */ /* Issue #149 - an inferred name can be null. avoid crash */
if (s) if (s)
{ {
for ( ; *s != '\0'; s++) { for ( ; *s != '\0'; s++) {
tmbchar c = *s; tmbchar c = *s;
@ -1051,8 +1051,8 @@ static uint anchorNameHash5(ctmbstr s)
} }
/*\ /*\
* removes anchor for specific node * removes anchor for specific node
* Issue #185 - Treat elements ids as case-sensitive * Issue #185 - Treat elements ids as case-sensitive
* if in HTML5 modes, make hash of value AS IS! * if in HTML5 modes, make hash of value AS IS!
\*/ \*/
@ -1096,7 +1096,7 @@ static Anchor* NewAnchor( TidyDocImpl* doc, ctmbstr name, Node* node )
} }
/*\ /*\
* add new anchor to namespace * add new anchor to namespace
* Issue #185 - Treat elements ids as case-sensitive * Issue #185 - Treat elements ids as case-sensitive
* if in HTML5 modes, make hash of value AS IS! * if in HTML5 modes, make hash of value AS IS!
\*/ \*/
@ -1124,7 +1124,7 @@ static Anchor* AddAnchor( TidyDocImpl* doc, ctmbstr name, Node *node )
} }
/*\ /*\
* return node associated with anchor * return node associated with anchor
* Issue #185 - Treat elements ids as case-sensitive * Issue #185 - Treat elements ids as case-sensitive
* if in HTML5 modes, make hash of value AS IS! * if in HTML5 modes, make hash of value AS IS!
\*/ \*/
@ -1148,7 +1148,7 @@ static Node* GetNodeByAnchor( TidyDocImpl* doc, ctmbstr name )
if ( TY_(tmbstrcmp)(found->name, lname) == 0 ) if ( TY_(tmbstrcmp)(found->name, lname) == 0 )
break; break;
} }
TidyDocFree(doc, lname); TidyDocFree(doc, lname);
if ( found ) if ( found )
return found->node; return found->node;
@ -1350,7 +1350,7 @@ void TY_(RepairDuplicateAttributes)( TidyDocImpl* doc, Node *node, Bool isXml )
temp = first->next; temp = first->next;
TY_(ReportAttrError)( doc, node, first, REPEATED_ATTRIBUTE); TY_(ReportAttrError)( doc, node, first, REPEATED_ATTRIBUTE);
TY_(RemoveAttribute)( doc, node, first ); TY_(RemoveAttribute)( doc, node, first );
firstRedefined = yes; firstRedefined = aye;
first = temp; first = temp;
second = second->next; second = second->next;
} }
@ -1376,16 +1376,16 @@ const Attribute* TY_(CheckAttribute)( TidyDocImpl* doc, Node *node, AttVal *attv
{ {
if (attrIsXML_LANG(attval) || attrIsXML_SPACE(attval)) if (attrIsXML_LANG(attval) || attrIsXML_SPACE(attval))
{ {
doc->lexer->isvoyager = yes; doc->lexer->isvoyager = aye;
if (!cfgBool(doc, TidyHtmlOut)) if (!cfgBool(doc, TidyHtmlOut))
{ {
TY_(SetOptionBool)(doc, TidyXhtmlOut, yes); TY_(SetOptionBool)(doc, TidyXhtmlOut, aye);
TY_(SetOptionBool)(doc, TidyXmlOut, yes); TY_(SetOptionBool)(doc, TidyXmlOut, aye);
} }
} }
TY_(ConstrainVersion)(doc, AttributeVersions(node, attval)); TY_(ConstrainVersion)(doc, AttributeVersions(node, attval));
if (attribute->attrchk) if (attribute->attrchk)
attribute->attrchk( doc, node, attval ); attribute->attrchk( doc, node, attval );
} }
@ -1397,7 +1397,7 @@ Bool TY_(IsBoolAttribute)(AttVal *attval)
{ {
const Attribute *attribute = ( attval ? attval->dict : NULL ); const Attribute *attribute = ( attval ? attval->dict : NULL );
if ( attribute && attribute->attrchk == CH_BOOL ) if ( attribute && attribute->attrchk == CH_BOOL )
return yes; return aye;
return no; return no;
} }
@ -1438,17 +1438,17 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva
{ {
tmbstr p; tmbstr p;
Bool hasUpper = no; Bool hasUpper = no;
if (!AttrHasValue(attval)) if (!AttrHasValue(attval))
return; return;
p = attval->value; p = attval->value;
while (*p) while (*p)
{ {
if (TY_(IsUpper)(*p)) /* #501230 - fix by Terry Teague - 09 Jan 02 */ if (TY_(IsUpper)(*p)) /* #501230 - fix by Terry Teague - 09 Jan 02 */
{ {
hasUpper = yes; hasUpper = aye;
break; break;
} }
p++; p++;
@ -1459,7 +1459,7 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
if (lexer->isvoyager) if (lexer->isvoyager)
TY_(ReportAttrError)( doc, node, attval, ATTR_VALUE_NOT_LCASE); TY_(ReportAttrError)( doc, node, attval, ATTR_VALUE_NOT_LCASE);
if ( lexer->isvoyager || cfgBool(doc, TidyLowerLiterals) ) if ( lexer->isvoyager || cfgBool(doc, TidyLowerLiterals) )
attval->value = TY_(tmbstrtolower)(attval->value); attval->value = TY_(tmbstrtolower)(attval->value);
} }
@ -1469,13 +1469,13 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva
void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval) void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval)
{ {
tmbchar c; tmbchar c;
tmbstr dest, p; tmbstr dest, p;
uint escape_count = 0, backslash_count = 0; uint escape_count = 0, backslash_count = 0;
uint i, pos = 0; uint i, pos = 0;
uint len; uint len;
Bool isJavascript = no; Bool isJavascript = no;
if (!AttrHasValue(attval)) if (!AttrHasValue(attval))
{ {
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE); TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
@ -1483,7 +1483,7 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval)
} }
p = attval->value; p = attval->value;
isJavascript = isJavascript =
TY_(tmbstrncmp)(p,"javascript:",sizeof("javascript:")-1)==0; TY_(tmbstrncmp)(p,"javascript:",sizeof("javascript:")-1)==0;
@ -1504,7 +1504,7 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval)
Bool hadnonspace = no; Bool hadnonspace = no;
len = TY_(tmbstrlen)(p) + escape_count * 2 + 1; len = TY_(tmbstrlen)(p) + escape_count * 2 + 1;
dest = (tmbstr) TidyDocAlloc(doc, len); dest = (tmbstr) TidyDocAlloc(doc, len);
for (i = 0; 0 != (c = p[i]); ++i) for (i = 0; 0 != (c = p[i]); ++i)
{ {
if ((c > 0x7e) || (c <= 0x20) || (strchr("<>", c))) if ((c > 0x7e) || (c <= 0x20) || (strchr("<>", c)))
@ -1518,12 +1518,12 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval)
else else
{ {
pos += sprintf( dest + pos, "%%%02X", (byte)c ); pos += sprintf( dest + pos, "%%%02X", (byte)c );
hadnonspace = yes; hadnonspace = aye;
} }
} }
else else
{ {
hadnonspace = yes; hadnonspace = aye;
dest[pos++] = c; dest[pos++] = c;
} }
} }
@ -1578,7 +1578,7 @@ Bool TY_(IsValidHTMLID)(ctmbstr id)
if (TY_(IsHTMLSpace)(*s++)) if (TY_(IsHTMLSpace)(*s++))
return no; return no;
return yes; return aye;
} }
@ -1610,7 +1610,7 @@ Bool TY_(IsValidXMLID)(ctmbstr id)
return no; return no;
} }
return yes; return aye;
} }
static Bool IsValidNMTOKEN(ctmbstr name) static Bool IsValidNMTOKEN(ctmbstr name)
@ -1634,15 +1634,15 @@ static Bool IsValidNMTOKEN(ctmbstr name)
return no; return no;
} }
return yes; return aye;
} }
static Bool AttrValueIsAmong(AttVal *attval, ctmbstr const list[]) static Bool AttrValueIsAmong(AttVal *attval, ctmbstr const list[])
{ {
const ctmbstr *v; const ctmbstr *v;
for (v = list; *v; ++v) for (v = list; *v; ++v)
if (AttrValueIs(attval, *v)) if (AttrValueIs(attval, *v))
return yes; return aye;
return no; return no;
} }
@ -1789,7 +1789,7 @@ void CheckValign( TidyDocImpl* doc, Node *node, AttVal *attval)
void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval) void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval)
{ {
tmbstr p; tmbstr p;
if (!AttrHasValue(attval)) if (!AttrHasValue(attval))
{ {
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE); TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
@ -1801,7 +1801,7 @@ void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval)
return; return;
p = attval->value; p = attval->value;
if (!TY_(IsDigit)(*p++)) if (!TY_(IsDigit)(*p++))
{ {
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE); TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE);
@ -1858,7 +1858,7 @@ void CheckClear( TidyDocImpl* doc, Node *node, AttVal *attval)
} }
CheckLowerCaseAttrValue( doc, node, attval ); CheckLowerCaseAttrValue( doc, node, attval );
if (!AttrValueIsAmong(attval, values)) if (!AttrValueIsAmong(attval, values))
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE); TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE);
} }
@ -1878,7 +1878,7 @@ void CheckScope( TidyDocImpl* doc, Node *node, AttVal *attval)
void CheckNumber( TidyDocImpl* doc, Node *node, AttVal *attval) void CheckNumber( TidyDocImpl* doc, Node *node, AttVal *attval)
{ {
tmbstr p; tmbstr p;
if (!AttrHasValue(attval)) if (!AttrHasValue(attval))
{ {
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE); TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
@ -1891,7 +1891,7 @@ void CheckNumber( TidyDocImpl* doc, Node *node, AttVal *attval)
return; return;
p = attval->value; p = attval->value;
/* font size may be preceded by + or - */ /* font size may be preceded by + or - */
if ( nodeIsFONT(node) && (*p == '+' || *p == '-') ) if ( nodeIsFONT(node) && (*p == '+' || *p == '-') )
++p; ++p;
@ -1923,7 +1923,7 @@ static Bool IsValidColorCode(ctmbstr color)
if (!TY_(IsDigit)(color[i]) && !strchr("abcdef", TY_(ToLower)(color[i]))) if (!TY_(IsDigit)(color[i]) && !strchr("abcdef", TY_(ToLower)(color[i])))
return no; return no;
return yes; return aye;
} }
/* check color syntax and beautify value by option */ /* check color syntax and beautify value by option */
@ -1993,7 +1993,7 @@ void CheckVType( TidyDocImpl* doc, Node *node, AttVal *attval)
/* checks scrolling attribute */ /* checks scrolling attribute */
void CheckScroll( TidyDocImpl* doc, Node *node, AttVal *attval) void CheckScroll( TidyDocImpl* doc, Node *node, AttVal *attval)
{ {
ctmbstr const values[] = {"no", "auto", "yes", NULL}; ctmbstr const values[] = {"no", "auto", "aye", NULL};
CheckAttrValidity( doc, node, attval, values ); CheckAttrValidity( doc, node, attval, values );
} }
@ -2077,14 +2077,14 @@ void TY_(SortAttributes)(Node* node, TidyAttrSortStrategy strat)
/** /**
* Attribute sorting contributed by Adrian Wilkins, 2007 * Attribute sorting contributed by Adrian Wilkins, 2007
* *
* Portions copyright Simon Tatham 2001. * Portions copyright Simon Tatham 2001.
* *
* Merge sort algortithm adpated from listsort.c linked from * Merge sort algortithm adpated from listsort.c linked from
* http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html * http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
* *
* Original copyright notice proceeds below. * Original copyright notice proceeds below.
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without * files (the "Software"), to deal in the Software without
@ -2093,10 +2093,10 @@ void TY_(SortAttributes)(Node* node, TidyAttrSortStrategy strat)
* sell copies of the Software, and to permit persons to whom the * sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following * Software is furnished to do so, subject to the following
* conditions: * conditions:
* *
* The above copyright notice and this permission notice shall be * The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software. * included in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -2221,7 +2221,7 @@ AttVal *SortAttVal( AttVal *list, TidyAttrSortStrategy strat)
* correct * correct
* *
* @prefix takes prefix value pairs in the form: * @prefix takes prefix value pairs in the form:
* *
* NCName ':' ' '+ AnyURI * NCName ':' ' '+ AnyURI
*/ */

28
src/charsets.c

@ -204,7 +204,7 @@ static struct _charsetInfo
{ 54, "roman8", 0, no }, /* IANA */ { 54, "roman8", 0, no }, /* IANA */
{ 54, "r8", 0, no }, /* IANA */ { 54, "r8", 0, no }, /* IANA */
{ 54, "cshproman8", 0, no }, /* IANA */ { 54, "cshproman8", 0, no }, /* IANA */
{ 55, "hz-gb-2312", 52936, yes }, /* IANA */ { 55, "hz-gb-2312", 52936, aye }, /* IANA */
{ 56, "ibm-symbols", 0, no }, /* IANA */ { 56, "ibm-symbols", 0, no }, /* IANA */
{ 56, "csibmsymbols", 0, no }, /* IANA */ { 56, "csibmsymbols", 0, no }, /* IANA */
{ 57, "ibm-thai", 20838, no }, /* IANA */ { 57, "ibm-thai", 20838, no }, /* IANA */
@ -486,14 +486,14 @@ static struct _charsetInfo
{ 122, "csunicodelatin1", 0, no }, /* IANA */ { 122, "csunicodelatin1", 0, no }, /* IANA */
{ 123, "iso-10646-utf-1", 0, no }, /* IANA */ { 123, "iso-10646-utf-1", 0, no }, /* IANA */
{ 123, "csiso10646utf1", 0, no }, /* IANA */ { 123, "csiso10646utf1", 0, no }, /* IANA */
{ 124, "iso-2022-cn", 0, yes }, /* IANA */ { 124, "iso-2022-cn", 0, aye }, /* IANA */
{ 125, "iso-2022-cn-ext", 0, yes }, /* IANA */ { 125, "iso-2022-cn-ext", 0, aye }, /* IANA */
{ 126, "iso-2022-jp", 50220, yes }, /* IANA */ { 126, "iso-2022-jp", 50220, aye }, /* IANA */
{ 126, "csiso2022jp", 50220, yes }, /* IANA */ { 126, "csiso2022jp", 50220, aye }, /* IANA */
{ 127, "iso-2022-jp-2", 0, yes }, /* IANA */ { 127, "iso-2022-jp-2", 0, aye }, /* IANA */
{ 127, "csiso2022jp2", 0, yes }, /* IANA */ { 127, "csiso2022jp2", 0, aye }, /* IANA */
{ 128, "iso-2022-kr", 50225, yes }, /* IANA */ { 128, "iso-2022-kr", 50225, aye }, /* IANA */
{ 128, "csiso2022kr", 50225, yes }, /* IANA */ { 128, "csiso2022kr", 50225, aye }, /* IANA */
{ 129, "iso-8859-1-windows-3.0-latin-1", 0, no }, /* IANA */ { 129, "iso-8859-1-windows-3.0-latin-1", 0, no }, /* IANA */
{ 129, "cswindows30latin1", 0, no }, /* IANA */ { 129, "cswindows30latin1", 0, no }, /* IANA */
{ 130, "iso-8859-1-windows-3.1-latin-1", 0, no }, /* IANA */ { 130, "iso-8859-1-windows-3.1-latin-1", 0, no }, /* IANA */
@ -859,9 +859,9 @@ static struct _charsetInfo
{ 217, "dos-874", 874, no }, /* MICROSOFT */ { 217, "dos-874", 874, no }, /* MICROSOFT */
{ 218, "unicode-1-1", 0, no }, /* IANA */ { 218, "unicode-1-1", 0, no }, /* IANA */
{ 218, "csunicode11", 0, no }, /* IANA */ { 218, "csunicode11", 0, no }, /* IANA */
{ 219, "unicode-1-1-utf-7", 65000, yes }, /* IANA */ { 219, "unicode-1-1-utf-7", 65000, aye }, /* IANA */
{ 219, "csunicode11utf7", 65000, yes }, /* IANA */ { 219, "csunicode11utf7", 65000, aye }, /* IANA */
{ 219, "x-unicode-2-0-utf-7", 65000, yes }, /* MICROSOFT */ { 219, "x-unicode-2-0-utf-7", 65000, aye }, /* MICROSOFT */
{ 220, "unknown-8bit", 0, no }, /* IANA */ { 220, "unknown-8bit", 0, no }, /* IANA */
{ 220, "csunknown8bit", 0, no }, /* IANA */ { 220, "csunknown8bit", 0, no }, /* IANA */
{ 221, "us-dk", 0, no }, /* IANA */ { 221, "us-dk", 0, no }, /* IANA */
@ -875,8 +875,8 @@ static struct _charsetInfo
{ 225, "utf-32", 0, no }, /* IANA */ { 225, "utf-32", 0, no }, /* IANA */
{ 226, "utf-32be", 0, no }, /* IANA */ { 226, "utf-32be", 0, no }, /* IANA */
{ 227, "utf-32le", 0, no }, /* IANA */ { 227, "utf-32le", 0, no }, /* IANA */
{ 228, "utf-7", 65000, yes }, /* IANA */ { 228, "utf-7", 65000, aye }, /* IANA */
{ 228, "x-unicode-2-0-utf-7", 65000, yes }, /* MICROSOFT */ { 228, "x-unicode-2-0-utf-7", 65000, aye }, /* MICROSOFT */
{ 229, "utf-8", 65001, no }, /* IANA */ { 229, "utf-8", 65001, no }, /* IANA */
{ 229, "unicode-2-0-utf-8", 65001, no }, /* MICROSOFT */ { 229, "unicode-2-0-utf-8", 65001, no }, /* MICROSOFT */
{ 229, "unicode-1-1-utf-8", 65001, no }, /* MICROSOFT */ { 229, "unicode-1-1-utf-8", 65001, no }, /* MICROSOFT */

102
src/clean.c

@ -18,13 +18,13 @@
Such rules are applied to the element's content and then Such rules are applied to the element's content and then
to the element itself until none of the rules more apply. to the element itself until none of the rules more apply.
Having applied all the rules to an element, it will have Having applied all the rules to an element, it will have
a style attribute with one or more properties. a style attribute with one or more properties.
Other rules strip the element they apply to, replacing Other rules strip the element they apply to, replacing
it by style properties on the contents, e.g. it by style properties on the contents, e.g.
<dir><li><p>...</li></dir> -> <p style="margin-left 1em">... <dir><li><p>...</li></dir> -> <p style="margin-left 1em">...
These rules are applied to an element before processing These rules are applied to an element before processing
its content and replace the current element by the first its content and replace the current element by the first
element in the exposed content. element in the exposed content.
@ -175,7 +175,7 @@ static StyleProp* CreateProps( TidyDocImpl* doc, StyleProp* prop, ctmbstr style
{ {
if (*value_end == ';') if (*value_end == ';')
{ {
more = yes; more =aye;
break; break;
} }
@ -411,7 +411,7 @@ static void CleanBodyAttrs( TidyDocImpl* doc, Node* body )
tmbstr bgcolor = NULL; tmbstr bgcolor = NULL;
tmbstr color = NULL; tmbstr color = NULL;
AttVal* attr; AttVal* attr;
if (NULL != (attr = TY_(AttrGetById)(body, TidyAttr_BACKGROUND))) if (NULL != (attr = TY_(AttrGetById)(body, TidyAttr_BACKGROUND)))
{ {
bgurl = attr->value; bgurl = attr->value;
@ -497,7 +497,7 @@ static Bool NiceBody( TidyDocImpl* doc )
} }
} }
return yes; return aye;
} }
/* create style element using rules from dictionary */ /* create style element using rules from dictionary */
@ -513,7 +513,7 @@ static void CreateStyleElement( TidyDocImpl* doc )
node = TY_(NewNode)( doc->allocator, lexer ); node = TY_(NewNode)( doc->allocator, lexer );
node->type = StartTag; node->type = StartTag;
node->implicit = yes; node->implicit =aye;
node->element = TY_(tmbstrdup)(doc->allocator, "style"); node->element = TY_(tmbstrdup)(doc->allocator, "style");
TY_(FindTag)( doc, node ); TY_(FindTag)( doc, node );
@ -992,7 +992,7 @@ static Bool Dir2Div( TidyDocImpl* doc, Node *node, Node **ARG_UNUSED(pnode))
node->element = TY_(tmbstrdup)(doc->allocator, "div"); node->element = TY_(tmbstrdup)(doc->allocator, "div");
TY_(AddStyleProperty)( doc, node, "margin-left: 2em" ); TY_(AddStyleProperty)( doc, node, "margin-left: 2em" );
StripOnlyChild( doc, node ); StripOnlyChild( doc, node );
return yes; return aye;
} }
return no; return no;
@ -1033,12 +1033,12 @@ static Bool Center2Div( TidyDocImpl* doc, Node *node, Node **pnode)
TY_(InsertNodeAtStart)(parent, node); TY_(InsertNodeAtStart)(parent, node);
} }
return yes; return aye;
} }
#endif // 00000000 what is this doing inside an nodeIsCENTER(node)??? 0000000 #endif // 00000000 what is this doing inside an nodeIsCENTER(node)??? 0000000
RenameElem( doc, node, TidyTag_DIV ); RenameElem( doc, node, TidyTag_DIV );
TY_(AddStyleProperty)( doc, node, "text-align: center" ); TY_(AddStyleProperty)( doc, node, "text-align: center" );
return yes; return aye;
} }
return no; return no;
@ -1082,7 +1082,7 @@ static Bool CopyAttrs( TidyDocImpl* doc, Node *node, Node *child)
TY_(InsertAttributeAtEnd)( node, av1 ); TY_(InsertAttributeAtEnd)( node, av1 );
} }
return yes; return aye;
} }
/* /*
@ -1121,7 +1121,7 @@ static Bool MergeNestedElements( TidyDocImpl* doc,
MergeStyles( doc, node, child ); MergeStyles( doc, node, child );
StripOnlyChild( doc, node ); StripOnlyChild( doc, node );
return yes; return aye;
} }
/* /*
@ -1201,7 +1201,7 @@ static Bool NestedList( TidyDocImpl* doc, Node *node, Node **pnode )
} }
} }
return yes; return aye;
} }
return no; return no;
@ -1221,9 +1221,9 @@ Bool FindCSSSpanEq( Node *node, ctmbstr *s, Bool deprecatedOnly )
{ {
{ TidyTag_B, "font-weight: bold", no }, { TidyTag_B, "font-weight: bold", no },
{ TidyTag_I, "font-style: italic", no }, { TidyTag_I, "font-style: italic", no },
{ TidyTag_S, "text-decoration: line-through", yes}, { TidyTag_S, "text-decoration: line-through",aye},
{ TidyTag_STRIKE, "text-decoration: line-through", yes}, { TidyTag_STRIKE, "text-decoration: line-through",aye},
{ TidyTag_U, "text-decoration: underline", yes}, { TidyTag_U, "text-decoration: underline",aye},
{ TidyTag_UNKNOWN, NULL, no } { TidyTag_UNKNOWN, NULL, no }
}; };
uint i; uint i;
@ -1233,9 +1233,9 @@ Bool FindCSSSpanEq( Node *node, ctmbstr *s, Bool deprecatedOnly )
&& TagIsId(node, CSS_SpanEq[i].id) ) && TagIsId(node, CSS_SpanEq[i].id) )
{ {
*s = CSS_SpanEq[i].CSSeq; *s = CSS_SpanEq[i].CSSeq;
return yes; return aye;
} }
return no; return no;
} }
/* Necessary conditions to apply BlockStyle(). */ /* Necessary conditions to apply BlockStyle(). */
@ -1245,7 +1245,7 @@ static Bool CanApplyBlockStyle( Node *node )
&& !nodeIsDIV(node) && !nodeIsP(node) && !nodeIsDIV(node) && !nodeIsP(node)
&& !nodeIsTABLE(node) && !nodeIsTR(node) && !nodeIsLI(node) ) && !nodeIsTABLE(node) && !nodeIsTR(node) && !nodeIsLI(node) )
{ {
return yes; return aye;
} }
return no; return no;
} }
@ -1302,14 +1302,14 @@ static Bool BlockStyle( TidyDocImpl* doc, Node *node, Node **ARG_UNUSED(pnode) )
MergeStyles( doc, node, child ); MergeStyles( doc, node, child );
TY_(AddStyleProperty)( doc, node, CSSeq ); TY_(AddStyleProperty)( doc, node, CSSeq );
StripOnlyChild( doc, node ); StripOnlyChild( doc, node );
return yes; return aye;
} }
else if ( nodeIsFONT(child) ) else if ( nodeIsFONT(child) )
{ {
MergeStyles( doc, node, child ); MergeStyles( doc, node, child );
AddFontStyles( doc, node, child->attributes ); AddFontStyles( doc, node, child->attributes );
StripOnlyChild( doc, node ); StripOnlyChild( doc, node );
return yes; return aye;
} }
} }
@ -1345,14 +1345,14 @@ static Bool InlineStyle( TidyDocImpl* doc, Node *node, Node **ARG_UNUSED(pnode)
MergeStyles( doc, node, child ); MergeStyles( doc, node, child );
TY_(AddStyleProperty)( doc, node, CSSeq ); TY_(AddStyleProperty)( doc, node, CSSeq );
StripOnlyChild( doc, node ); StripOnlyChild( doc, node );
return yes; return aye;
} }
else if ( nodeIsFONT(child) ) else if ( nodeIsFONT(child) )
{ {
MergeStyles( doc, node, child ); MergeStyles( doc, node, child );
AddFontStyles( doc, node, child->attributes ); AddFontStyles( doc, node, child->attributes );
StripOnlyChild( doc, node ); StripOnlyChild( doc, node );
return yes; return aye;
} }
} }
@ -1374,14 +1374,14 @@ static Bool InlineElementToCSS( TidyDocImpl* doc, Node* node,
|| CanApplyInlineStyle(node->parent)) ) || CanApplyInlineStyle(node->parent)) )
return no; return no;
if ( FindCSSSpanEq(node, &CSSeq, yes) ) if ( FindCSSSpanEq(node, &CSSeq,aye) )
{ {
RenameElem( doc, node, TidyTag_SPAN ); RenameElem( doc, node, TidyTag_SPAN );
TY_(AddStyleProperty)( doc, node, CSSeq ); TY_(AddStyleProperty)( doc, node, CSSeq );
return yes; return aye;
} }
return no; return no;
} }
/* /*
Replace font elements by span elements, deleting Replace font elements by span elements, deleting
@ -1397,7 +1397,7 @@ static Bool Font2Span( TidyDocImpl* doc, Node *node, Node **pnode )
if ( cfgBool(doc, TidyDropFontTags) ) if ( cfgBool(doc, TidyDropFontTags) )
{ {
DiscardContainer( doc, node, pnode ); DiscardContainer( doc, node, pnode );
return yes; return aye;
} }
/* if node is the only child of parent element then leave alone /* if node is the only child of parent element then leave alone
@ -1430,7 +1430,7 @@ static Bool Font2Span( TidyDocImpl* doc, Node *node, Node **pnode )
node->attributes = style; node->attributes = style;
RenameElem( doc, node, TidyTag_SPAN ); RenameElem( doc, node, TidyTag_SPAN );
return yes; return aye;
} }
return no; return no;
@ -1526,7 +1526,7 @@ static void DefineStyleRules( TidyDocImpl* doc, Node *node )
void TY_(CleanDocument)( TidyDocImpl* doc ) void TY_(CleanDocument)( TidyDocImpl* doc )
{ {
/* placeholder. CleanTree()/CleanNode() will not /* placeholder. CleanTree()/CleanNode() will not
** zap root element ** zap root element
*/ */
CleanTree( doc, &doc->root ); CleanTree( doc, &doc->root );
@ -1605,7 +1605,7 @@ void TY_(List2BQ)( TidyDocImpl* doc, Node* node )
{ {
StripOnlyChild( doc, node ); StripOnlyChild( doc, node );
RenameElem( doc, node, TidyTag_BLOCKQUOTE ); RenameElem( doc, node, TidyTag_BLOCKQUOTE );
node->implicit = yes; node->implicit =aye;
} }
node = node->next; node = node->next;
@ -1695,7 +1695,7 @@ static Node* PruneSection( TidyDocImpl* doc, Node *node )
if (node == NULL) if (node == NULL)
return NULL; return NULL;
if (node->type == SectionTag) if (node->type == SectionTag)
{ {
if (TY_(tmbstrncmp)(lexer->lexbuf + node->start, "if", 2) == 0) if (TY_(tmbstrncmp)(lexer->lexbuf + node->start, "if", 2) == 0)
@ -1873,7 +1873,7 @@ static Bool NoMargins(Node *node)
if (!TY_(tmbsubstr)(attval->value, "margin-bottom: 0")) if (!TY_(tmbsubstr)(attval->value, "margin-bottom: 0"))
return no; return no;
return yes; return aye;
} }
/* does element have a single space as its content? */ /* does element have a single space as its content? */
@ -1891,14 +1891,14 @@ static Bool SingleSpace( Lexer* lexer, Node* node )
if ( (node->end - node->start) == 1 && if ( (node->end - node->start) == 1 &&
lexer->lexbuf[node->start] == ' ' ) lexer->lexbuf[node->start] == ' ' )
return yes; return aye;
if ( (node->end - node->start) == 2 ) if ( (node->end - node->start) == 2 )
{ {
uint c = 0; uint c = 0;
TY_(GetUTF8)( lexer->lexbuf + node->start, &c ); TY_(GetUTF8)( lexer->lexbuf + node->start, &c );
if ( c == 160 ) if ( c == 160 )
return yes; return aye;
} }
} }
@ -1932,7 +1932,7 @@ void TY_(CleanWord2000)( TidyDocImpl* doc, Node *node)
/* Output proprietary attributes to maintain errout compatability /* Output proprietary attributes to maintain errout compatability
* with traditional Tidy. This is a result of moving all of the * with traditional Tidy. This is a result of moving all of the
* proprietary checks to near the end of the cleanup process, * proprietary checks to near the end of the cleanup process,
* meaning this result would not ordinarily be displayed. * meaning this result would not ordinarily be displayed.
*/ */
attval = node->attributes; attval = node->attributes;
while ( attval ) { while ( attval ) {
@ -1953,7 +1953,7 @@ void TY_(CleanWord2000)( TidyDocImpl* doc, Node *node)
if (NoMargins(node)) if (NoMargins(node))
{ {
Node *pre, *next; Node *pre, *next;
TY_(CoerceNode)(doc, node, TidyTag_PRE, no, yes); TY_(CoerceNode)(doc, node, TidyTag_PRE, no,aye);
PurgeWord2000Attributes( doc, node ); PurgeWord2000Attributes( doc, node );
@ -2040,7 +2040,7 @@ void TY_(CleanWord2000)( TidyDocImpl* doc, Node *node)
if ( nodeIsP(node) ) if ( nodeIsP(node) )
{ {
AttVal *attr, *atrStyle; AttVal *attr, *atrStyle;
attr = TY_(AttrGetById)(node, TidyAttr_CLASS); attr = TY_(AttrGetById)(node, TidyAttr_CLASS);
atrStyle = TY_(AttrGetById)(node, TidyAttr_STYLE); atrStyle = TY_(AttrGetById)(node, TidyAttr_STYLE);
/* /*
@ -2058,7 +2058,7 @@ void TY_(CleanWord2000)( TidyDocImpl* doc, Node *node)
if (AttrValueIs(attr, "MsoListNumber")) if (AttrValueIs(attr, "MsoListNumber"))
listType = TidyTag_OL; listType = TidyTag_OL;
TY_(CoerceNode)(doc, node, TidyTag_LI, no, yes); TY_(CoerceNode)(doc, node, TidyTag_LI, no,aye);
if ( !list || TagId(list) != listType ) if ( !list || TagId(list) != listType )
{ {
@ -2123,8 +2123,8 @@ Bool TY_(IsWord2000)( TidyDocImpl* doc )
Node *html = TY_(FindHTML)( doc ); Node *html = TY_(FindHTML)( doc );
if (html && TY_(GetAttrByName)(html, "xmlns:o")) if (html && TY_(GetAttrByName)(html, "xmlns:o"))
return yes; return aye;
/* search for <meta name="GENERATOR" content="Microsoft ..."> */ /* search for <meta name="GENERATOR" content="Microsoft ..."> */
head = TY_(FindHEAD)( doc ); head = TY_(FindHEAD)( doc );
@ -2143,7 +2143,7 @@ Bool TY_(IsWord2000)( TidyDocImpl* doc )
attval = TY_(AttrGetById)( node, TidyAttr_CONTENT ); attval = TY_(AttrGetById)( node, TidyAttr_CONTENT );
if ( AttrContains(attval, "Microsoft") ) if ( AttrContains(attval, "Microsoft") )
return yes; return aye;
} }
} }
@ -2184,7 +2184,7 @@ void TY_(BumpObject)( TidyDocImpl* doc, Node *html )
if ( (TY_(nodeIsText)(child) && !TY_(IsBlank)(doc->lexer, node)) if ( (TY_(nodeIsText)(child) && !TY_(IsBlank)(doc->lexer, node))
|| !nodeIsPARAM(child) ) || !nodeIsPARAM(child) )
{ {
bump = yes; bump =aye;
break; break;
} }
} }
@ -2222,15 +2222,15 @@ void FixBrakes( TidyDocImpl* pDoc, Node *pParent )
/* As long as my last child is a <br />, move it to my last peer */ /* As long as my last child is a <br />, move it to my last peer */
if ( nodeCMIsBlock( pParent )) if ( nodeCMIsBlock( pParent ))
{ {
for ( pNode = pParent->last; for ( pNode = pParent->last;
NULL != pNode && nodeIsBR( pNode ); NULL != pNode && nodeIsBR( pNode );
pNode = pParent->last ) pNode = pParent->last )
{ {
if ( NULL == pNode->attributes && no == bBRDeleted ) if ( NULL == pNode->attributes && no == bBRDeleted )
{ {
TY_(DiscardElement)( pDoc, pNode ); TY_(DiscardElement)( pDoc, pNode );
bBRDeleted = yes; bBRDeleted =aye;
} }
else else
{ {
@ -2418,7 +2418,7 @@ void TY_(WbrToSpace)(TidyDocImpl* doc, Node* node)
<p title='&#x2018;'>...</p> <p title='&#x2018;'>...</p>
got got
<p title='''>...</p> <p title='''>...</p>
Since browser support is much better nowadays and Since browser support is much better nowadays and
@ -2566,7 +2566,7 @@ void TY_(FixLanguageInformation)(TidyDocImpl* doc, Node* node, Bool wantXmlLang,
if (lang && !wantLang) if (lang && !wantLang)
TY_(RemoveAttribute)(doc, node, lang); TY_(RemoveAttribute)(doc, node, lang);
if (xmlLang && !wantXmlLang) if (xmlLang && !wantXmlLang)
TY_(RemoveAttribute)(doc, node, xmlLang); TY_(RemoveAttribute)(doc, node, xmlLang);
} }
@ -2641,7 +2641,7 @@ void TY_(FixAnchors)(TidyDocImpl* doc, Node *node, Bool wantName, Bool wantId)
if (TY_(IsValidHTMLID)(name->value)) if (TY_(IsValidHTMLID)(name->value))
{ {
TY_(RepairAttrValue)(doc, node, "id", name->value); TY_(RepairAttrValue)(doc, node, "id", name->value);
IdEmitted = yes; IdEmitted =aye;
} }
else else
TY_(ReportAttrError)(doc, node, name, INVALID_XML_ID); TY_(ReportAttrError)(doc, node, name, INVALID_XML_ID);
@ -2654,7 +2654,7 @@ void TY_(FixAnchors)(TidyDocImpl* doc, Node *node, Bool wantName, Bool wantId)
{ {
/* todo: do not assume id is valid */ /* todo: do not assume id is valid */
TY_(RepairAttrValue)(doc, node, "name", id->value); TY_(RepairAttrValue)(doc, node, "name", id->value);
NameEmitted = yes; NameEmitted =aye;
} }
} }

150
src/config.c

@ -1,6 +1,6 @@
/* /*
config.c -- read config file and manage config properties config.c -- read config file and manage config properties
(c) 1998-2008 (W3C) MIT, ERCIM, Keio University (c) 1998-2008 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice. See tidy.h for the copyright notice.
@ -58,14 +58,14 @@ void TY_(FreeConfig)( TidyDocImpl* doc )
/* Arrange so index can be cast to enum /* Arrange so index can be cast to enum
*/ */
static const ctmbstr boolPicks[] = static const ctmbstr boolPicks[] =
{ {
"no", "no",
"yes", "yes",
NULL NULL
}; };
static const ctmbstr autoBoolPicks[] = static const ctmbstr autoBoolPicks[] =
{ {
"no", "no",
"yes", "yes",
@ -73,14 +73,14 @@ static const ctmbstr autoBoolPicks[] =
NULL NULL
}; };
static const ctmbstr repeatAttrPicks[] = static const ctmbstr repeatAttrPicks[] =
{ {
"keep-first", "keep-first",
"keep-last", "keep-last",
NULL NULL
}; };
static const ctmbstr accessPicks[] = static const ctmbstr accessPicks[] =
{ {
"0 (Tidy Classic)", "0 (Tidy Classic)",
"1 (Priority 1 Checks)", "1 (Priority 1 Checks)",
@ -89,7 +89,7 @@ static const ctmbstr accessPicks[] =
NULL NULL
}; };
static const ctmbstr charEncPicks[] = static const ctmbstr charEncPicks[] =
{ {
"raw", "raw",
"ascii", "ascii",
@ -117,7 +117,7 @@ static const ctmbstr charEncPicks[] =
NULL NULL
}; };
static const ctmbstr newlinePicks[] = static const ctmbstr newlinePicks[] =
{ {
"LF", "LF",
"CRLF", "CRLF",
@ -125,7 +125,7 @@ static const ctmbstr newlinePicks[] =
NULL NULL
}; };
static const ctmbstr doctypePicks[] = static const ctmbstr doctypePicks[] =
{ {
"html5", "html5",
"omit", "omit",
@ -133,10 +133,10 @@ static const ctmbstr doctypePicks[] =
"strict", "strict",
"transitional", "transitional",
"user", "user",
NULL NULL
}; };
static const ctmbstr sorterPicks[] = static const ctmbstr sorterPicks[] =
{ {
"none", "none",
"alpha", "alpha",
@ -162,7 +162,7 @@ static const ctmbstr sorterPicks[] =
#if SUPPORT_ACCESSIBILITY_CHECKS #if SUPPORT_ACCESSIBILITY_CHECKS
#define ParseAcc ParseInt #define ParseAcc ParseInt
#else #else
#define ParseAcc NULL #define ParseAcc NULL
#endif #endif
static void AdjustConfig( TidyDocImpl* doc ); static void AdjustConfig( TidyDocImpl* doc );
@ -192,7 +192,7 @@ static ParseProperty ParseTagNames;
/* alpha */ /* alpha */
static ParseProperty ParseSorter; static ParseProperty ParseSorter;
/* RAW, ASCII, LATIN0, LATIN1, UTF8, ISO2022, MACROMAN, /* RAW, ASCII, LATIN0, LATIN1, UTF8, ISO2022, MACROMAN,
WIN1252, IBM858, UTF16LE, UTF16BE, UTF16, BIG5, SHIFTJIS WIN1252, IBM858, UTF16LE, UTF16BE, UTF16, BIG5, SHIFTJIS
*/ */
static ParseProperty ParseCharEnc; static ParseProperty ParseCharEnc;
@ -206,7 +206,7 @@ static ParseProperty ParseRepeatAttr;
/*\ /*\
* 20150515 - support using tabs instead of spaces - Issue #108 * 20150515 - support using tabs instead of spaces - Issue #108
* (a) parser for 't'/'f', 'true'/'false', 'y'/'n', 'yes'/'no' or '1'/'0' * (a) parser for 't'/'f', 'true'/'false', 'y'/'n', 'yes'/'no' or '1'/'0'
* (b) sets the TidyIndentSpaces to 1 if 'yes' * (b) sets the TidyIndentSpaces to 1 if 'yes'
* (c) sets the indent_char to '\t' or ' ' * (c) sets the indent_char to '\t' or ' '
\*/ \*/
@ -233,12 +233,12 @@ static const TidyOptionImpl option_defs[] =
{ TidyErrFile, MS, "error-file", ST, 0, ParseString, NULL }, { TidyErrFile, MS, "error-file", ST, 0, ParseString, NULL },
{ TidyOutFile, MS, "output-file", ST, 0, ParseString, NULL }, { TidyOutFile, MS, "output-file", ST, 0, ParseString, NULL },
{ TidyWriteBack, MS, "write-back", BL, no, ParseBool, boolPicks }, { TidyWriteBack, MS, "write-back", BL, no, ParseBool, boolPicks },
{ TidyShowMarkup, PP, "markup", BL, yes, ParseBool, boolPicks }, { TidyShowMarkup, PP, "markup", BL, aye, ParseBool, boolPicks },
{ TidyShowInfo, DG, "show-info", BL, yes, ParseBool, boolPicks }, { TidyShowInfo, DG, "show-info", BL, aye, ParseBool, boolPicks },
{ TidyShowWarnings, DG, "show-warnings", BL, yes, ParseBool, boolPicks }, { TidyShowWarnings, DG, "show-warnings", BL, aye, ParseBool, boolPicks },
{ TidyQuiet, MS, "quiet", BL, no, ParseBool, boolPicks }, { TidyQuiet, MS, "quiet", BL, no, ParseBool, boolPicks },
{ TidyIndentContent, PP, "indent", IN, TidyNoState, ParseAutoBool, autoBoolPicks }, { TidyIndentContent, PP, "indent", IN, TidyNoState, ParseAutoBool, autoBoolPicks },
{ TidyCoerceEndTags, MU, "coerce-endtags", BL, yes, ParseBool, boolPicks }, { TidyCoerceEndTags, MU, "coerce-endtags", BL, aye, ParseBool, boolPicks },
{ TidyOmitOptionalTags, MU, "omit-optional-tags", BL, no, ParseBool, boolPicks }, { TidyOmitOptionalTags, MU, "omit-optional-tags", BL, no, ParseBool, boolPicks },
{ TidyHideEndTags, MU, "hide-endtags", BL, no, ParseBool, boolPicks }, { TidyHideEndTags, MU, "hide-endtags", BL, no, ParseBool, boolPicks },
{ TidyXmlTags, MU, "input-xml", BL, no, ParseBool, boolPicks }, { TidyXmlTags, MU, "input-xml", BL, no, ParseBool, boolPicks },
@ -254,9 +254,9 @@ static const TidyOptionImpl option_defs[] =
{ TidyLogicalEmphasis, MU, "logical-emphasis", BL, no, ParseBool, boolPicks }, { TidyLogicalEmphasis, MU, "logical-emphasis", BL, no, ParseBool, boolPicks },
{ TidyDropPropAttrs, MU, "drop-proprietary-attributes", BL, no, ParseBool, boolPicks }, { TidyDropPropAttrs, MU, "drop-proprietary-attributes", BL, no, ParseBool, boolPicks },
{ TidyDropFontTags, MU, "drop-font-tags", BL, no, ParseBool, boolPicks }, { TidyDropFontTags, MU, "drop-font-tags", BL, no, ParseBool, boolPicks },
{ TidyDropEmptyElems, MU, "drop-empty-elements", BL, yes, ParseBool, boolPicks }, { TidyDropEmptyElems, MU, "drop-empty-elements", BL, aye, ParseBool, boolPicks },
{ TidyDropEmptyParas, MU, "drop-empty-paras", BL, yes, ParseBool, boolPicks }, { TidyDropEmptyParas, MU, "drop-empty-paras", BL, aye, ParseBool, boolPicks },
{ TidyFixComments, MU, "fix-bad-comments", BL, yes, ParseBool, boolPicks }, { TidyFixComments, MU, "fix-bad-comments", BL, aye, ParseBool, boolPicks },
{ TidyBreakBeforeBR, PP, "break-before-br", BL, no, ParseBool, boolPicks }, { TidyBreakBeforeBR, PP, "break-before-br", BL, no, ParseBool, boolPicks },
/* obsolete */ /* obsolete */
@ -264,15 +264,15 @@ static const TidyOptionImpl option_defs[] =
{ TidyNumEntities, MU, "numeric-entities", BL, no, ParseBool, boolPicks }, { TidyNumEntities, MU, "numeric-entities", BL, no, ParseBool, boolPicks },
{ TidyQuoteMarks, MU, "quote-marks", BL, no, ParseBool, boolPicks }, { TidyQuoteMarks, MU, "quote-marks", BL, no, ParseBool, boolPicks },
{ TidyQuoteNbsp, MU, "quote-nbsp", BL, yes, ParseBool, boolPicks }, { TidyQuoteNbsp, MU, "quote-nbsp", BL, aye, ParseBool, boolPicks },
{ TidyQuoteAmpersand, MU, "quote-ampersand", BL, yes, ParseBool, boolPicks }, { TidyQuoteAmpersand, MU, "quote-ampersand", BL, aye, ParseBool, boolPicks },
{ TidyWrapAttVals, PP, "wrap-attributes", BL, no, ParseBool, boolPicks }, { TidyWrapAttVals, PP, "wrap-attributes", BL, no, ParseBool, boolPicks },
{ TidyWrapScriptlets, PP, "wrap-script-literals", BL, no, ParseBool, boolPicks }, { TidyWrapScriptlets, PP, "wrap-script-literals", BL, no, ParseBool, boolPicks },
{ TidyWrapSection, PP, "wrap-sections", BL, yes, ParseBool, boolPicks }, { TidyWrapSection, PP, "wrap-sections", BL, aye, ParseBool, boolPicks },
{ TidyWrapAsp, PP, "wrap-asp", BL, yes, ParseBool, boolPicks }, { TidyWrapAsp, PP, "wrap-asp", BL, aye, ParseBool, boolPicks },
{ TidyWrapJste, PP, "wrap-jste", BL, yes, ParseBool, boolPicks }, { TidyWrapJste, PP, "wrap-jste", BL, aye, ParseBool, boolPicks },
{ TidyWrapPhp, PP, "wrap-php", BL, yes, ParseBool, boolPicks }, { TidyWrapPhp, PP, "wrap-php", BL, aye, ParseBool, boolPicks },
{ TidyFixBackslash, MU, "fix-backslash", BL, yes, ParseBool, boolPicks }, { TidyFixBackslash, MU, "fix-backslash", BL, aye, ParseBool, boolPicks },
{ TidyIndentAttributes, PP, "indent-attributes", BL, no, ParseBool, boolPicks }, { TidyIndentAttributes, PP, "indent-attributes", BL, no, ParseBool, boolPicks },
{ TidyXmlPIs, MU, "assume-xml-procins", BL, no, ParseBool, boolPicks }, { TidyXmlPIs, MU, "assume-xml-procins", BL, no, ParseBool, boolPicks },
{ TidyXmlSpace, MU, "add-xml-space", BL, no, ParseBool, boolPicks }, { TidyXmlSpace, MU, "add-xml-space", BL, no, ParseBool, boolPicks },
@ -280,24 +280,24 @@ static const TidyOptionImpl option_defs[] =
{ TidyEncloseBlockText, MU, "enclose-block-text", BL, no, ParseBool, boolPicks }, { TidyEncloseBlockText, MU, "enclose-block-text", BL, no, ParseBool, boolPicks },
{ TidyKeepFileTimes, MS, "keep-time", BL, no, ParseBool, boolPicks }, { TidyKeepFileTimes, MS, "keep-time", BL, no, ParseBool, boolPicks },
{ TidyWord2000, MU, "word-2000", BL, no, ParseBool, boolPicks }, { TidyWord2000, MU, "word-2000", BL, no, ParseBool, boolPicks },
{ TidyMark, MS, "tidy-mark", BL, yes, ParseBool, boolPicks }, { TidyMark, MS, "tidy-mark", BL, aye, ParseBool, boolPicks },
{ TidyEmacs, MS, "gnu-emacs", BL, no, ParseBool, boolPicks }, { TidyEmacs, MS, "gnu-emacs", BL, no, ParseBool, boolPicks },
{ TidyEmacsFile, MS, "gnu-emacs-file", ST, 0, ParseString, NULL }, { TidyEmacsFile, MS, "gnu-emacs-file", ST, 0, ParseString, NULL },
{ TidyLiteralAttribs, MU, "literal-attributes", BL, no, ParseBool, boolPicks }, { TidyLiteralAttribs, MU, "literal-attributes", BL, no, ParseBool, boolPicks },
{ TidyBodyOnly, MU, "show-body-only", IN, no, ParseAutoBool, autoBoolPicks }, { TidyBodyOnly, MU, "show-body-only", IN, no, ParseAutoBool, autoBoolPicks },
{ TidyFixUri, MU, "fix-uri", BL, yes, ParseBool, boolPicks }, { TidyFixUri, MU, "fix-uri", BL, aye, ParseBool, boolPicks },
{ TidyLowerLiterals, MU, "lower-literals", BL, yes, ParseBool, boolPicks }, { TidyLowerLiterals, MU, "lower-literals", BL, aye, ParseBool, boolPicks },
{ TidyHideComments, MU, "hide-comments", BL, no, ParseBool, boolPicks }, { TidyHideComments, MU, "hide-comments", BL, no, ParseBool, boolPicks },
{ TidyIndentCdata, MU, "indent-cdata", BL, no, ParseBool, boolPicks }, { TidyIndentCdata, MU, "indent-cdata", BL, no, ParseBool, boolPicks },
{ TidyForceOutput, MS, "force-output", BL, no, ParseBool, boolPicks }, { TidyForceOutput, MS, "force-output", BL, no, ParseBool, boolPicks },
{ TidyShowErrors, DG, "show-errors", IN, 6, ParseInt, NULL }, { TidyShowErrors, DG, "show-errors", IN, 6, ParseInt, NULL },
{ TidyAsciiChars, CE, "ascii-chars", BL, no, ParseBool, boolPicks }, { TidyAsciiChars, CE, "ascii-chars", BL, no, ParseBool, boolPicks },
{ TidyJoinClasses, MU, "join-classes", BL, no, ParseBool, boolPicks }, { TidyJoinClasses, MU, "join-classes", BL, no, ParseBool, boolPicks },
{ TidyJoinStyles, MU, "join-styles", BL, yes, ParseBool, boolPicks }, { TidyJoinStyles, MU, "join-styles", BL, aye, ParseBool, boolPicks },
{ TidyEscapeCdata, MU, "escape-cdata", BL, no, ParseBool, boolPicks }, { TidyEscapeCdata, MU, "escape-cdata", BL, no, ParseBool, boolPicks },
#if SUPPORT_ASIAN_ENCODINGS #if SUPPORT_ASIAN_ENCODINGS
{ TidyLanguage, CE, "language", ST, 0, ParseName, NULL }, { TidyLanguage, CE, "language", ST, 0, ParseName, NULL },
{ TidyNCR, MU, "ncr", BL, yes, ParseBool, boolPicks }, { TidyNCR, MU, "ncr", BL, aye, ParseBool, boolPicks },
#endif #endif
#if SUPPORT_UTF16_ENCODINGS #if SUPPORT_UTF16_ENCODINGS
{ TidyOutputBOM, CE, "output-bom", IN, TidyAutoState, ParseAutoBool, autoBoolPicks }, { TidyOutputBOM, CE, "output-bom", IN, TidyAutoState, ParseAutoBool, autoBoolPicks },
@ -313,17 +313,17 @@ static const TidyOptionImpl option_defs[] =
#if SUPPORT_ASIAN_ENCODINGS #if SUPPORT_ASIAN_ENCODINGS
{ TidyPunctWrap, PP, "punctuation-wrap", BL, no, ParseBool, boolPicks }, { TidyPunctWrap, PP, "punctuation-wrap", BL, no, ParseBool, boolPicks },
#endif #endif
{ TidyMergeEmphasis, MU, "merge-emphasis", BL, yes, ParseBool, boolPicks }, { TidyMergeEmphasis, MU, "merge-emphasis", BL, aye, ParseBool, boolPicks },
{ TidyMergeDivs, MU, "merge-divs", IN, TidyAutoState, ParseAutoBool, autoBoolPicks }, { TidyMergeDivs, MU, "merge-divs", IN, TidyAutoState, ParseAutoBool, autoBoolPicks },
{ TidyDecorateInferredUL, MU, "decorate-inferred-ul", BL, no, ParseBool, boolPicks }, { TidyDecorateInferredUL, MU, "decorate-inferred-ul", BL, no, ParseBool, boolPicks },
{ TidyPreserveEntities, MU, "preserve-entities", BL, no, ParseBool, boolPicks }, { TidyPreserveEntities, MU, "preserve-entities", BL, no, ParseBool, boolPicks },
{ TidySortAttributes, PP, "sort-attributes", IN, TidySortAttrNone,ParseSorter, sorterPicks }, { TidySortAttributes, PP, "sort-attributes", IN, TidySortAttrNone,ParseSorter, sorterPicks },
{ TidyMergeSpans, MU, "merge-spans", IN, TidyAutoState, ParseAutoBool, autoBoolPicks }, { TidyMergeSpans, MU, "merge-spans", IN, TidyAutoState, ParseAutoBool, autoBoolPicks },
{ TidyAnchorAsName, MU, "anchor-as-name", BL, yes, ParseBool, boolPicks }, { TidyAnchorAsName, MU, "anchor-as-name", BL, aye, ParseBool, boolPicks },
{ TidyPPrintTabs, PP, "indent-with-tabs", BL, no, ParseTabs, boolPicks }, /* 20150515 - Issue #108 */ { TidyPPrintTabs, PP, "indent-with-tabs", BL, no, ParseTabs, boolPicks }, /* 20150515 - Issue #108 */
{ TidySkipNested, MU, "skip-nested", BL, yes, ParseBool, boolPicks }, /* 1642186 - Issue #65 */ { TidySkipNested, MU, "skip-nested", BL, aye, ParseBool, boolPicks }, /* 1642186 - Issue #65 */
{ TidyStrictTagsAttr, MU, "strict-tags-attributes", BL, no, ParseBool, boolPicks }, /* 20160209 - Issue #350 */ { TidyStrictTagsAttr, MU, "strict-tags-attributes", BL, no, ParseBool, boolPicks }, /* 20160209 - Issue #350 */
{ TidyEscapeScripts, PP, "escape-scripts", BL, yes, ParseBool, boolPicks }, /* 20160227 - Issue #348 */ { TidyEscapeScripts, PP, "escape-scripts", BL, aye, ParseBool, boolPicks }, /* 20160227 - Issue #348 */
{ N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL } { N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL }
}; };
@ -459,7 +459,7 @@ static Bool OptionValueIdentical( const TidyOptionImpl* option,
if ( option->type == TidyString ) if ( option->type == TidyString )
{ {
if ( val1->p == val2->p ) if ( val1->p == val2->p )
return yes; return aye;
if ( !val1->p || !val2->p ) if ( !val1->p || !val2->p )
return no; return no;
return TY_(tmbstrcmp)( val1->p, val2->p ) == 0; return TY_(tmbstrcmp)( val1->p, val2->p ) == 0;
@ -487,7 +487,7 @@ static Bool NeedReparseTagDecls( const TidyOptionValue* current,
if (!OptionValueIdentical(option,&current[ixVal],&new[ixVal])) \ if (!OptionValueIdentical(option,&current[ixVal],&new[ixVal])) \
{ \ { \
*changedUserTags |= USERTAGTYPE; \ *changedUserTags |= USERTAGTYPE; \
ret = yes; \ ret = aye; \
} \ } \
break break
TEST_USERTAGS(TidyInlineTags,tagtype_inline); TEST_USERTAGS(TidyInlineTags,tagtype_inline);
@ -554,7 +554,7 @@ void TY_(ResetConfigToSnapshot)( TidyDocImpl* doc )
uint changedUserTags; uint changedUserTags;
Bool needReparseTagsDecls = NeedReparseTagDecls( value, snap, Bool needReparseTagsDecls = NeedReparseTagDecls( value, snap,
&changedUserTags ); &changedUserTags );
for ( ixVal=0; ixVal < N_TIDY_OPTIONS; ++option, ++ixVal ) for ( ixVal=0; ixVal < N_TIDY_OPTIONS; ++option, ++ixVal )
{ {
assert( ixVal == (uint) option->id ); assert( ixVal == (uint) option->id );
@ -702,9 +702,9 @@ static uint NextProperty( TidyConfigImpl* config )
/* /*
Todd Lewis contributed this code for expanding Todd Lewis contributed this code for expanding
~/foo or ~your/foo according to $HOME and your ~/foo or ~your/foo according to $HOME and your
user name. This will work partially on any system user name. This will work partially on any system
which defines $HOME. Support for ~user/foo will which defines $HOME. Support for ~user/foo will
work on systems that support getpwnam(userid), work on systems that support getpwnam(userid),
namely Unix/Linux. namely Unix/Linux.
*/ */
static ctmbstr ExpandTilde( TidyDocImpl* doc, ctmbstr filename ) static ctmbstr ExpandTilde( TidyDocImpl* doc, ctmbstr filename )
@ -811,7 +811,7 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
tchar c; tchar c;
cfg->cfgIn = TY_(FileInput)( doc, fin, enc ); cfg->cfgIn = TY_(FileInput)( doc, fin, enc );
c = FirstChar( cfg ); c = FirstChar( cfg );
for ( c = SkipWhite(cfg); c != EndOfStream; c = NextProperty(cfg) ) for ( c = SkipWhite(cfg); c != EndOfStream; c = NextProperty(cfg) )
{ {
uint ix = 0; uint ix = 0;
@ -841,7 +841,7 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
tmbchar buf[8192]; tmbchar buf[8192];
uint i = 0; uint i = 0;
tchar delim = 0; tchar delim = 0;
Bool waswhite = yes; Bool waswhite = aye;
tchar c = SkipWhite( cfg ); tchar c = SkipWhite( cfg );
@ -881,7 +881,7 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
} }
} }
TY_(freeFileSource)(&cfg->cfgIn->source, yes); TY_(freeFileSource)(&cfg->cfgIn->source, aye);
TY_(freeStreamIn)( cfg->cfgIn ); TY_(freeStreamIn)( cfg->cfgIn );
cfg->cfgIn = NULL; cfg->cfgIn = NULL;
} }
@ -892,7 +892,7 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
AdjustConfig( doc ); AdjustConfig( doc );
/* any new config errors? If so, return warning status. */ /* any new config errors? If so, return warning status. */
return (doc->optionErrors > opterrs ? 1 : 0); return (doc->optionErrors > opterrs ? 1 : 0);
} }
/* returns false if unknown option, missing parameter, /* returns false if unknown option, missing parameter,
@ -904,14 +904,14 @@ Bool TY_(ParseConfigOption)( TidyDocImpl* doc, ctmbstr optnam, ctmbstr optval )
Bool status = ( option != NULL ); Bool status = ( option != NULL );
if ( !status ) if ( !status )
{ {
/* Not a standard tidy option. Check to see if the user application /* Not a standard tidy option. Check to see if the user application
recognizes it */ recognizes it */
if (NULL != doc->pOptCallback) if (NULL != doc->pOptCallback)
status = (*doc->pOptCallback)( optnam, optval ); status = (*doc->pOptCallback)( optnam, optval );
if (!status) if (!status)
TY_(ReportUnknownOption)( doc, optnam ); TY_(ReportUnknownOption)( doc, optnam );
} }
else else
status = TY_(ParseConfigValue)( doc, option->id, optval ); status = TY_(ParseConfigValue)( doc, option->id, optval );
return status; return status;
} }
@ -952,7 +952,7 @@ Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding )
{ {
int outenc = -1; int outenc = -1;
int inenc = -1; int inenc = -1;
switch( encoding ) switch( encoding )
{ {
case MACROMAN: case MACROMAN:
@ -1005,7 +1005,7 @@ Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding )
TY_(SetOptionInt)( doc, TidyCharEncoding, encoding ); TY_(SetOptionInt)( doc, TidyCharEncoding, encoding );
TY_(SetOptionInt)( doc, TidyInCharEncoding, inenc ); TY_(SetOptionInt)( doc, TidyInCharEncoding, inenc );
TY_(SetOptionInt)( doc, TidyOutCharEncoding, outenc ); TY_(SetOptionInt)( doc, TidyOutCharEncoding, outenc );
return yes; return aye;
} }
return no; return no;
} }
@ -1014,7 +1014,7 @@ Bool TY_(AdjustCharEncoding)( TidyDocImpl* doc, int encoding )
void AdjustConfig( TidyDocImpl* doc ) void AdjustConfig( TidyDocImpl* doc )
{ {
if ( cfgBool(doc, TidyEncloseBlockText) ) if ( cfgBool(doc, TidyEncloseBlockText) )
TY_(SetOptionBool)( doc, TidyEncloseBodyText, yes ); TY_(SetOptionBool)( doc, TidyEncloseBodyText, aye );
if ( cfgAutoBool(doc, TidyIndentContent) == TidyNoState ) if ( cfgAutoBool(doc, TidyIndentContent) == TidyNoState )
TY_(SetOptionInt)( doc, TidyIndentSpaces, 0 ); TY_(SetOptionInt)( doc, TidyIndentSpaces, 0 );
@ -1037,17 +1037,17 @@ void AdjustConfig( TidyDocImpl* doc )
/* XHTML is written in lower case */ /* XHTML is written in lower case */
if ( cfgBool(doc, TidyXhtmlOut) ) if ( cfgBool(doc, TidyXhtmlOut) )
{ {
TY_(SetOptionBool)( doc, TidyXmlOut, yes ); TY_(SetOptionBool)( doc, TidyXmlOut, aye );
TY_(SetOptionBool)( doc, TidyUpperCaseTags, no ); TY_(SetOptionBool)( doc, TidyUpperCaseTags, no );
TY_(SetOptionBool)( doc, TidyUpperCaseAttrs, no ); TY_(SetOptionBool)( doc, TidyUpperCaseAttrs, no );
/* TY_(SetOptionBool)( doc, TidyXmlPIs, yes ); */ /* TY_(SetOptionBool)( doc, TidyXmlPIs, aye ); */
} }
/* if XML in, then XML out */ /* if XML in, then XML out */
if ( cfgBool(doc, TidyXmlTags) ) if ( cfgBool(doc, TidyXmlTags) )
{ {
TY_(SetOptionBool)( doc, TidyXmlOut, yes ); TY_(SetOptionBool)( doc, TidyXmlOut, aye );
TY_(SetOptionBool)( doc, TidyXmlPIs, yes ); TY_(SetOptionBool)( doc, TidyXmlPIs, aye );
} }
/* #427837 - fix by Dave Raggett 02 Jun 01 /* #427837 - fix by Dave Raggett 02 Jun 01
@ -1064,7 +1064,7 @@ void AdjustConfig( TidyDocImpl* doc )
cfg(doc, TidyOutCharEncoding) != RAW && cfg(doc, TidyOutCharEncoding) != RAW &&
cfgBool(doc, TidyXmlOut) ) cfgBool(doc, TidyXmlOut) )
{ {
TY_(SetOptionBool)( doc, TidyXmlDecl, yes ); TY_(SetOptionBool)( doc, TidyXmlDecl, aye );
} }
/* XML requires end tags */ /* XML requires end tags */
@ -1074,9 +1074,9 @@ void AdjustConfig( TidyDocImpl* doc )
/* XML requires a BOM on output if using UTF-16 encoding */ /* XML requires a BOM on output if using UTF-16 encoding */
ulong enc = cfg( doc, TidyOutCharEncoding ); ulong enc = cfg( doc, TidyOutCharEncoding );
if ( enc == UTF16LE || enc == UTF16BE || enc == UTF16 ) if ( enc == UTF16LE || enc == UTF16BE || enc == UTF16 )
TY_(SetOptionInt)( doc, TidyOutputBOM, yes ); TY_(SetOptionInt)( doc, TidyOutputBOM, aye );
#endif #endif
TY_(SetOptionBool)( doc, TidyQuoteAmpersand, yes ); TY_(SetOptionBool)( doc, TidyQuoteAmpersand, aye );
TY_(SetOptionBool)( doc, TidyHideEndTags, no ); TY_(SetOptionBool)( doc, TidyHideEndTags, no );
} }
} }
@ -1092,7 +1092,7 @@ Bool ParseInt( TidyDocImpl* doc, const TidyOptionImpl* entry )
while ( TY_(IsDigit)(c) ) while ( TY_(IsDigit)(c) )
{ {
number = c - '0' + (10 * number); number = c - '0' + (10 * number);
digits = yes; digits = aye;
c = AdvanceChar( cfg ); c = AdvanceChar( cfg );
} }
@ -1103,7 +1103,7 @@ Bool ParseInt( TidyDocImpl* doc, const TidyOptionImpl* entry )
return digits; return digits;
} }
/* true/false or yes/no or 0/1 or "auto" only looks at 1st char */ /* true/false or aye/no or 0/1 or "auto" only looks at 1st char */
static Bool ParseTriState( TidyTriState theState, TidyDocImpl* doc, static Bool ParseTriState( TidyTriState theState, TidyDocImpl* doc,
const TidyOptionImpl* entry, ulong* flag ) const TidyOptionImpl* entry, ulong* flag )
{ {
@ -1111,7 +1111,7 @@ static Bool ParseTriState( TidyTriState theState, TidyDocImpl* doc,
tchar c = SkipWhite( cfg ); tchar c = SkipWhite( cfg );
if (c == 't' || c == 'T' || c == 'y' || c == 'Y' || c == '1') if (c == 't' || c == 'T' || c == 'y' || c == 'Y' || c == '1')
*flag = yes; *flag = aye;
else if (c == 'f' || c == 'F' || c == 'n' || c == 'N' || c == '0') else if (c == 'f' || c == 'F' || c == 'n' || c == 'N' || c == '0')
*flag = no; *flag = no;
else if (theState == TidyAutoState && (c == 'a' || c =='A')) else if (theState == TidyAutoState && (c == 'a' || c =='A'))
@ -1122,7 +1122,7 @@ static Bool ParseTriState( TidyTriState theState, TidyDocImpl* doc,
return no; return no;
} }
return yes; return aye;
} }
/* cr, lf or crlf */ /* cr, lf or crlf */
@ -1221,7 +1221,7 @@ Bool ParseCSS1Selector( TidyDocImpl* doc, const TidyOptionImpl* option )
/* Tidy appends last digits. */ /* Tidy appends last digits. */
SetOptionValue( doc, option->id, buf ); SetOptionValue( doc, option->id, buf );
return yes; return aye;
} }
/*\ /*\
@ -1234,7 +1234,7 @@ Bool ParseTabs( TidyDocImpl* doc, const TidyOptionImpl* entry )
ulong flag = 0; ulong flag = 0;
Bool status = ParseTriState( TidyNoState, doc, entry, &flag ); Bool status = ParseTriState( TidyNoState, doc, entry, &flag );
if ( status ) { if ( status ) {
Bool tabs = flag != 0 ? yes : no; Bool tabs = flag != 0 ? aye : no;
TY_(SetOptionBool)( doc, entry->id, tabs ); TY_(SetOptionBool)( doc, entry->id, tabs );
if (tabs) { if (tabs) {
TY_(SetOptionInt)( doc, TidyIndentSpaces, 1 ); TY_(SetOptionInt)( doc, TidyIndentSpaces, 1 );
@ -1339,7 +1339,7 @@ Bool ParseTagNames( TidyDocImpl* doc, const TidyOptionImpl* option )
buf[i] = '\0'; buf[i] = '\0';
if (i == 0) /* Skip empty tag definition. Possible when */ if (i == 0) /* Skip empty tag definition. Possible when */
continue; /* there is a trailing space on the line. */ continue; /* there is a trailing space on the line. */
/* add tag to dictionary */ /* add tag to dictionary */
DeclareUserTag( doc, option->id, ttyp, buf ); DeclareUserTag( doc, option->id, ttyp, buf );
i = 0; i = 0;
@ -1361,7 +1361,7 @@ Bool ParseString( TidyDocImpl* doc, const TidyOptionImpl* option )
tmbchar buf[8192]; tmbchar buf[8192];
uint i = 0; uint i = 0;
tchar delim = 0; tchar delim = 0;
Bool waswhite = yes; Bool waswhite = aye;
tchar c = SkipWhite( cfg ); tchar c = SkipWhite( cfg );
@ -1394,7 +1394,7 @@ Bool ParseString( TidyDocImpl* doc, const TidyOptionImpl* option )
buf[i] = '\0'; buf[i] = '\0';
SetOptionValue( doc, option->id, buf ); SetOptionValue( doc, option->id, buf );
return yes; return aye;
} }
Bool ParseCharEnc( TidyDocImpl* doc, const TidyOptionImpl* option ) Bool ParseCharEnc( TidyDocImpl* doc, const TidyOptionImpl* option )
@ -1402,7 +1402,7 @@ Bool ParseCharEnc( TidyDocImpl* doc, const TidyOptionImpl* option )
tmbchar buf[64] = {0}; tmbchar buf[64] = {0};
uint i = 0; uint i = 0;
int enc = ASCII; int enc = ASCII;
Bool validEncoding = yes; Bool validEncoding = aye;
tchar c = SkipWhite( &doc->config ); tchar c = SkipWhite( &doc->config );
while ( i < sizeof(buf)-2 && c != EndOfStream && !TY_(IsWhite)(c) ) while ( i < sizeof(buf)-2 && c != EndOfStream && !TY_(IsWhite)(c) )
@ -1481,7 +1481,7 @@ Bool ParseDocType( TidyDocImpl* doc, const TidyOptionImpl* option )
{ {
tmbchar buf[ 32 ] = {0}; tmbchar buf[ 32 ] = {0};
uint i = 0; uint i = 0;
Bool status = yes; Bool status = aye;
TidyDoctypeModes dtmode = TidyDoctypeAuto; TidyDoctypeModes dtmode = TidyDoctypeAuto;
TidyConfigImpl* cfg = &doc->config; TidyConfigImpl* cfg = &doc->config;
@ -1522,7 +1522,7 @@ Bool ParseDocType( TidyDocImpl* doc, const TidyOptionImpl* option )
TY_(ReportBadArgument)( doc, option->name ); TY_(ReportBadArgument)( doc, option->name );
status = no; status = no;
} }
if ( status ) if ( status )
TY_(SetOptionInt)( doc, TidyDoctypeMode, dtmode ); TY_(SetOptionInt)( doc, TidyDoctypeMode, dtmode );
return status; return status;
@ -1530,7 +1530,7 @@ Bool ParseDocType( TidyDocImpl* doc, const TidyOptionImpl* option )
Bool ParseRepeatAttr( TidyDocImpl* doc, const TidyOptionImpl* option ) Bool ParseRepeatAttr( TidyDocImpl* doc, const TidyOptionImpl* option )
{ {
Bool status = yes; Bool status = aye;
tmbchar buf[64] = {0}; tmbchar buf[64] = {0};
uint i = 0; uint i = 0;
@ -1558,7 +1558,7 @@ Bool ParseRepeatAttr( TidyDocImpl* doc, const TidyOptionImpl* option )
Bool ParseSorter( TidyDocImpl* doc, const TidyOptionImpl* option ) Bool ParseSorter( TidyDocImpl* doc, const TidyOptionImpl* option )
{ {
Bool status = yes; Bool status = aye;
tmbchar buf[64] = {0}; tmbchar buf[64] = {0};
uint i = 0; uint i = 0;
@ -1712,16 +1712,16 @@ static int SaveConfigToStream( TidyDocImpl* doc, StreamOut* out )
if ( dtmode == TidyDoctypeUser ) if ( dtmode == TidyDoctypeUser )
{ {
tmbstr t; tmbstr t;
/* add 2 double quotes */ /* add 2 double quotes */
if (( t = (tmbstr)TidyDocAlloc( doc, TY_(tmbstrlen)( val->p ) + 2 ) )) if (( t = (tmbstr)TidyDocAlloc( doc, TY_(tmbstrlen)( val->p ) + 2 ) ))
{ {
t[0] = '\"'; t[1] = 0; t[0] = '\"'; t[1] = 0;
TY_(tmbstrcat)( t, val->p ); TY_(tmbstrcat)( t, val->p );
TY_(tmbstrcat)( t, "\"" ); TY_(tmbstrcat)( t, "\"" );
rc = WriteOptionString( option, t, out ); rc = WriteOptionString( option, t, out );
TidyDocFree( doc, t ); TidyDocFree( doc, t );
} }
} }
@ -1743,7 +1743,7 @@ static int SaveConfigToStream( TidyDocImpl* doc, StreamOut* out )
rc = WriteOptionInt( option, val->v, out ); rc = WriteOptionInt( option, val->v, out );
break; break;
case TidyBoolean: case TidyBoolean:
rc = WriteOptionBool( option, val->v ? yes : no, out ); rc = WriteOptionBool( option, val->v ? aye : no, out );
break; break;
} }
} }

8
src/entities.c

@ -4,7 +4,7 @@
See tidy.h for the copyright notice. See tidy.h for the copyright notice.
Entity handling can be static because there are no config or Entity handling can be static because there are no config or
document-specific values. Lookup table is 100% defined at document-specific values. Lookup table is 100% defined at
compile time. compile time.
*/ */
@ -137,7 +137,7 @@ static const entity entities[] =
{ "yuml", VERS_ALL, 255 }, { "yuml", VERS_ALL, 255 },
/* /*
** Extended Entities defined in HTML 4: Symbols ** Extended Entities defined in HTML 4: Symbols
*/ */
{ "fnof", VERS_FROM40, 402 }, { "fnof", VERS_FROM40, 402 },
{ "Alpha", VERS_FROM40, 913 }, { "Alpha", VERS_FROM40, 913 },
@ -373,7 +373,7 @@ Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions )
{ {
*code = c; *code = c;
*versions = VERS_ALL; *versions = VERS_ALL;
return yes; return aye;
} }
else else
{ {
@ -388,7 +388,7 @@ Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions )
{ {
*code = np->code; *code = np->code;
*versions = np->versions; *versions = np->versions;
return yes; return aye;
} }
*code = 0; *code = 0;

56
src/htmltidy.cpp

@ -1,12 +1,12 @@
#include <Rcpp.h> #include <Rcpp.h>
using namespace Rcpp;
#include <tidy.h> #include <tidy.h>
#include <tidybuffio.h> #include <tidybuffio.h>
// NOTE: cannot do "using namespace Rcpp;" b/c of annoying warnings about the ambiguity of 'yes'. // [[Rcpp::export]]
Rcpp::CharacterVector do_the_tidy(std::string source,
//[[Rcpp::export]] Rcpp::List options,
Rcpp::CharacterVector tidy_html_int(std::string source, Rcpp::List options,
bool show_errors) { bool show_errors) {
TidyBuffer output = {0}; TidyBuffer output = {0};
@ -17,117 +17,117 @@ Rcpp::CharacterVector tidy_html_int(std::string source, Rcpp::List options,
TidyDoc tdoc = tidyCreate(); TidyDoc tdoc = tidyCreate();
if (options.containsElementNamed("TidyXhtmlOut")) { if (options.containsElementNamed("TidyXhtmlOut")) {
ok = tidyOptSetBool(tdoc, TidyXhtmlOut, options["TidyXhtmlOut"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyXhtmlOut, options["TidyXhtmlOut"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyHtmlOut")) { if (options.containsElementNamed("TidyHtmlOut")) {
ok = tidyOptSetBool(tdoc, TidyHtmlOut, options["TidyHtmlOut"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyHtmlOut, options["TidyHtmlOut"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyOmitOptionalTags")) { if (options.containsElementNamed("TidyOmitOptionalTags")) {
ok = tidyOptSetBool(tdoc, TidyOmitOptionalTags, options["TidyOmitOptionalTags"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyOmitOptionalTags, options["TidyOmitOptionalTags"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyBreakBeforeBR")) { if (options.containsElementNamed("TidyBreakBeforeBR")) {
ok = tidyOptSetBool(tdoc, TidyBreakBeforeBR, options["TidyBreakBeforeBR"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyBreakBeforeBR, options["TidyBreakBeforeBR"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyUpperCaseTags")) { if (options.containsElementNamed("TidyUpperCaseTags")) {
ok = tidyOptSetBool(tdoc, TidyUpperCaseTags, options["TidyUpperCaseTags"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyUpperCaseTags, options["TidyUpperCaseTags"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyUpperCaseAttrs")) { if (options.containsElementNamed("TidyUpperCaseAttrs")) {
ok = tidyOptSetBool(tdoc, TidyUpperCaseAttrs, options["TidyUpperCaseAttrs"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyUpperCaseAttrs, options["TidyUpperCaseAttrs"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyDropEmptyElems")) { if (options.containsElementNamed("TidyDropEmptyElems")) {
ok = tidyOptSetBool(tdoc, TidyDropEmptyElems, options["TidyDropEmptyElems"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyDropEmptyElems, options["TidyDropEmptyElems"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyDropEmptyParas")) { if (options.containsElementNamed("TidyDropEmptyParas")) {
ok = tidyOptSetBool(tdoc, TidyDropEmptyParas, options["TidyDropEmptyParas"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyDropEmptyParas, options["TidyDropEmptyParas"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyFixComments")) { if (options.containsElementNamed("TidyFixComments")) {
ok = tidyOptSetBool(tdoc, TidyFixComments, options["TidyFixComments"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyFixComments, options["TidyFixComments"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyLogicalEmphasis")) { if (options.containsElementNamed("TidyLogicalEmphasis")) {
ok = tidyOptSetBool(tdoc, TidyLogicalEmphasis, options["TidyLogicalEmphasis"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyLogicalEmphasis, options["TidyLogicalEmphasis"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyBodyOnly")) { if (options.containsElementNamed("TidyBodyOnly")) {
ok = tidyOptSetBool(tdoc, TidyBodyOnly, options["TidyBodyOnly"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyBodyOnly, options["TidyBodyOnly"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyHideComments")) { if (options.containsElementNamed("TidyHideComments")) {
ok = tidyOptSetBool(tdoc, TidyHideComments, options["TidyHideComments"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyHideComments, options["TidyHideComments"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyJoinClasses")) { if (options.containsElementNamed("TidyJoinClasses")) {
ok = tidyOptSetBool(tdoc, TidyJoinClasses, options["TidyJoinClasses"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyJoinClasses, options["TidyJoinClasses"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyJoinStyles")) { if (options.containsElementNamed("TidyJoinStyles")) {
ok = tidyOptSetBool(tdoc, TidyJoinStyles, options["TidyJoinStyles"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyJoinStyles, options["TidyJoinStyles"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyFixBackslash")) { if (options.containsElementNamed("TidyFixBackslash")) {
ok = tidyOptSetBool(tdoc, TidyFixBackslash, options["TidyFixBackslash"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyFixBackslash, options["TidyFixBackslash"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyMark")) { if (options.containsElementNamed("TidyMark")) {
ok = tidyOptSetBool(tdoc, TidyMark, options["TidyMark"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyMark, options["TidyMark"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyReplaceColor")) { if (options.containsElementNamed("TidyReplaceColor")) {
ok = tidyOptSetBool(tdoc, TidyReplaceColor, options["TidyReplaceColor"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyReplaceColor, options["TidyReplaceColor"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyIndentContent")) { if (options.containsElementNamed("TidyIndentContent")) {
ok = tidyOptSetBool(tdoc, TidyIndentContent, options["TidyIndentContent"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyIndentContent, options["TidyIndentContent"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyCoerceEndTags")) { if (options.containsElementNamed("TidyCoerceEndTags")) {
ok = tidyOptSetBool(tdoc, TidyCoerceEndTags, options["TidyCoerceEndTags"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyCoerceEndTags, options["TidyCoerceEndTags"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyMakeBare")) { if (options.containsElementNamed("TidyMakeBare")) {
ok = tidyOptSetBool(tdoc, TidyMakeBare, options["TidyMakeBare"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyMakeBare, options["TidyMakeBare"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyMakeClean")) { if (options.containsElementNamed("TidyMakeClean")) {
ok = tidyOptSetBool(tdoc, TidyMakeClean, options["TidyMakeClean"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyMakeClean, options["TidyMakeClean"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyGDocClean")) { if (options.containsElementNamed("TidyGDocClean")) {
ok = tidyOptSetBool(tdoc, TidyGDocClean, options["TidyGDocClean"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyGDocClean, options["TidyGDocClean"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
if (options.containsElementNamed("TidyWord2000")) { if (options.containsElementNamed("TidyWord2000")) {
ok = tidyOptSetBool(tdoc, TidyWord2000, options["TidyWord2000"] ? yes : no); ok = tidyOptSetBool(tdoc, TidyWord2000, options["TidyWord2000"] ? aye : no);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
@ -176,7 +176,7 @@ Rcpp::CharacterVector tidy_html_int(std::string source, Rcpp::List options,
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
} }
ok = tidyOptSetBool(tdoc, TidyForceOutput, yes); ok = tidyOptSetBool(tdoc, TidyForceOutput, aye);
if (ok == no) Rcpp::stop("Error setting TidyHTML options"); if (ok == no) Rcpp::stop("Error setting TidyHTML options");
rc = tidySetErrorBuffer(tdoc, &errbuf); rc = tidySetErrorBuffer(tdoc, &errbuf);

22
src/init.c

@ -1,22 +0,0 @@
#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>
/* FIXME:
Check these declarations against the C/Fortran source code.
*/
/* .Call calls */
extern SEXP htmltidy_tidy_html_int(SEXP, SEXP, SEXP);
static const R_CallMethodDef CallEntries[] = {
{"htmltidy_tidy_html_int", (DL_FUNC) &htmltidy_tidy_html_int, 3},
{NULL, NULL, 0}
};
void R_init_htmltidy(DllInfo *dll)
{
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}

22
src/istack.c

@ -2,7 +2,7 @@
(c) 1998-2006 (W3C) MIT, ERCIM, Keio University (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice. See tidy.h for the copyright notice.
*/ */
#include "tidy-int.h" #include "tidy-int.h"
@ -50,7 +50,7 @@ static Bool IsNodePushable( Node *node )
if (nodeIsINS(node) || nodeIsDEL(node)) if (nodeIsINS(node) || nodeIsDEL(node))
return no; return no;
return yes; return aye;
} }
/* /*
@ -171,7 +171,7 @@ Bool TY_(IsPushed)( TidyDocImpl* doc, Node *node )
for (i = lexer->istacksize - 1; i >= 0; --i) for (i = lexer->istacksize - 1; i >= 0; --i)
{ {
if (lexer->istack[i].tag == node->tag) if (lexer->istack[i].tag == node->tag)
return yes; return aye;
} }
return no; return no;
@ -189,7 +189,7 @@ Bool TY_(IsPushedLast)( TidyDocImpl* doc, Node *element, Node *node )
if (lexer->istacksize > 0) { if (lexer->istacksize > 0) {
if (lexer->istack[lexer->istacksize - 1].tag == node->tag) { if (lexer->istack[lexer->istacksize - 1].tag == node->tag) {
return yes; return aye;
} }
} }
@ -265,9 +265,9 @@ Node *TY_(InsertedToken)( TidyDocImpl* doc )
node = TY_(NewNode)(doc->allocator, lexer); node = TY_(NewNode)(doc->allocator, lexer);
node->type = StartTag; node->type = StartTag;
node->implicit = yes; node->implicit = aye;
node->start = lexer->txtstart; node->start = lexer->txtstart;
/* #431734 [JTidy bug #226261 (was 126261)] - fix by Gary Peskin 20 Dec 00 */ /* #431734 [JTidy bug #226261 (was 126261)] - fix by Gary Peskin 20 Dec 00 */
node->end = lexer->txtend; /* was : lexer->txtstart; */ node->end = lexer->txtend; /* was : lexer->txtstart; */
istack = lexer->insert; istack = lexer->insert;
@ -301,7 +301,7 @@ Node *TY_(InsertedToken)( TidyDocImpl* doc )
but, like the browser, the second should be retained ... but, like the browser, the second should be retained ...
Like <b>bold <i>bold and italics</b> italics only</i> Like <b>bold <i>bold and italics</b> italics only</i>
This function switches the tag positions on the stack, This function switches the tag positions on the stack,
returning 'yes' if both were found in the expected order. returning 'aye' if both were found in the expected order.
*/ */
Bool TY_(SwitchInline)( TidyDocImpl* doc, Node* element, Node* node ) Bool TY_(SwitchInline)( TidyDocImpl* doc, Node* element, Node* node )
{ {
@ -310,7 +310,7 @@ Bool TY_(SwitchInline)( TidyDocImpl* doc, Node* element, Node* node )
&& element && element->tag && element && element->tag
&& node && node->tag && node && node->tag
&& TY_(IsPushed)( doc, element ) && TY_(IsPushed)( doc, element )
&& TY_(IsPushed)( doc, node ) && TY_(IsPushed)( doc, node )
&& ((lexer->istacksize - lexer->istackbase) >= 2) ) && ((lexer->istacksize - lexer->istackbase) >= 2) )
{ {
/* we have a chance of succeeding ... */ /* we have a chance of succeeding ... */
@ -337,7 +337,7 @@ Bool TY_(SwitchInline)( TidyDocImpl* doc, Node* element, Node* node )
IStack tmp_istack = *istack2; IStack tmp_istack = *istack2;
*istack2 = *istack1; *istack2 = *istack1;
*istack1 = tmp_istack; *istack1 = tmp_istack;
return yes; return aye;
} }
} }
} }
@ -348,7 +348,7 @@ Bool TY_(SwitchInline)( TidyDocImpl* doc, Node* element, Node* node )
/* /*
We want to push a specific a specific element on the stack, We want to push a specific a specific element on the stack,
but it may not be the last element, which InlineDup() but it may not be the last element, which InlineDup()
would handle. Return yes, if found and inserted. would handle. Return aye, if found and inserted.
*/ */
Bool TY_(InlineDup1)( TidyDocImpl* doc, Node* node, Node* element ) Bool TY_(InlineDup1)( TidyDocImpl* doc, Node* node, Node* element )
{ {
@ -363,7 +363,7 @@ Bool TY_(InlineDup1)( TidyDocImpl* doc, Node* node, Node* element )
/* found our element tag - insert it */ /* found our element tag - insert it */
lexer->insert = &(lexer->istack[i]); lexer->insert = &(lexer->istack[i]);
lexer->inode = node; lexer->inode = node;
return yes; return aye;
} }
} }
} }

100
src/lexer.c

@ -50,7 +50,7 @@
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
/* #define DEBUG_ALLOCATION special EXTRA allocation debug information - VERY NOISY */ /* #define DEBUG_ALLOCATION special EXTRA allocation debug information - VERY NOISY */
static void check_me(char *name); static void check_me(char *name);
static Bool show_attrs = yes; static Bool show_attrs = aye;
#define MX_TXT 8 #define MX_TXT 8
static char buffer[(MX_TXT*4)+8]; /* NOTE extra for '...'\0 tail */ static char buffer[(MX_TXT*4)+8]; /* NOTE extra for '...'\0 tail */
static tmbstr get_text_string(Lexer* lexer, Node *node) static tmbstr get_text_string(Lexer* lexer, Node *node)
@ -72,7 +72,7 @@ static tmbstr get_text_string(Lexer* lexer, Node *node)
} else if ( c == ' ' ) { } else if ( c == ' ' ) {
if (!insp) if (!insp)
buffer[i++] = c; buffer[i++] = c;
insp = yes; insp = aye;
} else { } else {
buffer[i++] = c; buffer[i++] = c;
insp = no; insp = no;
@ -93,7 +93,7 @@ static tmbstr get_text_string(Lexer* lexer, Node *node)
} else if ( c == ' ' ) { } else if ( c == ' ' ) {
if (!insp) if (!insp)
buffer[i++] = c; buffer[i++] = c;
insp = yes; insp = aye;
} else { } else {
buffer[i++] = c; buffer[i++] = c;
insp = no; insp = no;
@ -125,7 +125,7 @@ static tmbstr get_text_string(Lexer* lexer, Node *node)
} else if ( c == ' ' ) { } else if ( c == ' ' ) {
if (!insp) if (!insp)
buffer[i++] = c; buffer[i++] = c;
insp = yes; insp = aye;
} else { } else {
buffer[i++] = c; buffer[i++] = c;
insp = no; insp = no;
@ -138,7 +138,7 @@ static tmbstr get_text_string(Lexer* lexer, Node *node)
static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node ) static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node )
{ {
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
Bool lex = ((msg[0] == 'l')&&(msg[1] == 'e')) ? yes : no; Bool lex = ((msg[0] == 'l')&&(msg[1] == 'e')) ? aye : no;
int line = ( doc->lexer ? doc->lexer->lines : 0 ); int line = ( doc->lexer ? doc->lexer->lines : 0 );
int col = ( doc->lexer ? doc->lexer->columns : 0 ); int col = ( doc->lexer ? doc->lexer->columns : 0 );
tmbstr src = lex ? "lexer" : "stream"; tmbstr src = lex ? "lexer" : "stream";
@ -256,9 +256,9 @@ int TY_(HTMLVersion)(TidyDocImpl* doc)
Bool xhtml = (cfgBool(doc, TidyXmlOut) || doc->lexer->isvoyager) && Bool xhtml = (cfgBool(doc, TidyXmlOut) || doc->lexer->isvoyager) &&
!cfgBool(doc, TidyHtmlOut); !cfgBool(doc, TidyHtmlOut);
Bool html4 = ((dtmode == TidyDoctypeStrict) || (dtmode == TidyDoctypeLoose) || Bool html4 = ((dtmode == TidyDoctypeStrict) || (dtmode == TidyDoctypeLoose) ||
(VERS_FROM40 & dtver) ? yes : no); (VERS_FROM40 & dtver) ? aye : no);
Bool html5 = (!html4 && ((dtmode == TidyDoctypeAuto) || Bool html5 = (!html4 && ((dtmode == TidyDoctypeAuto) ||
(dtmode == TidyDoctypeHtml5)) ? yes : no); (dtmode == TidyDoctypeHtml5)) ? aye : no);
if (xhtml && dtver == VERS_UNKNOWN) return XH50; if (xhtml && dtver == VERS_UNKNOWN) return XH50;
if (dtver == VERS_UNKNOWN) return HT50; if (dtver == VERS_UNKNOWN) return HT50;
@ -410,7 +410,7 @@ void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers)
doc->lexer->versions &= (vers | VERS_PROPRIETARY); doc->lexer->versions &= (vers | VERS_PROPRIETARY);
if (curr != doc->lexer->versions) { /* only if different */ if (curr != doc->lexer->versions) { /* only if different */
if (!dnfirst) { if (!dnfirst) {
dnfirst = yes; dnfirst = aye;
vcur[0] = 0; vcur[0] = 0;
curr &= ~(VERS_PROPRIETARY); curr &= ~(VERS_PROPRIETARY);
add_vers_string( vcur, curr ); add_vers_string( vcur, curr );
@ -1088,7 +1088,7 @@ static void ParseEntity( TidyDocImpl* doc, GetTokenMode mode )
{ {
if ( c == ';' ) if ( c == ';' )
{ {
semicolon = yes; semicolon = aye;
break; break;
} }
++charRead; ++charRead;
@ -1144,10 +1144,10 @@ static void ParseEntity( TidyDocImpl* doc, GetTokenMode mode )
if (( mode == OtherNamespace ) && ( c == ';' )) if (( mode == OtherNamespace ) && ( c == ';' ))
{ {
/* #130 MathML attr and entity fix! */ /* #130 MathML attr and entity fix! */
found = yes; found = aye;
ch = 255; ch = 255;
entver = XH50|HT50; entver = XH50|HT50;
preserveEntities = yes; preserveEntities = aye;
} }
else else
{ {
@ -1713,7 +1713,7 @@ Bool TY_(AddGenerator)( TidyDocImpl* doc )
TY_(AddAttribute)( doc, node, "name", "generator" ); TY_(AddAttribute)( doc, node, "name", "generator" );
TY_(AddAttribute)( doc, node, "content", buf ); TY_(AddAttribute)( doc, node, "content", buf );
TY_(InsertNodeAtStart)( head, node ); TY_(InsertNodeAtStart)( head, node );
return yes; return aye;
} }
} }
@ -1745,9 +1745,9 @@ static uint FindGivenVersion( TidyDocImpl* doc, Node* doctype )
if (VERS_XHTML & vers) if (VERS_XHTML & vers)
{ {
TY_(SetOptionBool)(doc, TidyXmlOut, yes); TY_(SetOptionBool)(doc, TidyXmlOut, aye);
TY_(SetOptionBool)(doc, TidyXhtmlOut, yes); TY_(SetOptionBool)(doc, TidyXhtmlOut, aye);
doc->lexer->isvoyager = yes; doc->lexer->isvoyager = aye;
} }
/* todo: add a warning if case does not match? */ /* todo: add a warning if case does not match? */
@ -1800,7 +1800,7 @@ Bool TY_(WarnMissingSIInEmittedDocType)( TidyDocImpl* doc )
if ( (doctype = TY_(FindDocType)( doc )) != NULL if ( (doctype = TY_(FindDocType)( doc )) != NULL
&& TY_(GetAttrByName)(doctype, "SYSTEM") == NULL ) && TY_(GetAttrByName)(doctype, "SYSTEM") == NULL )
return yes; return aye;
return no; return no;
} }
@ -1840,7 +1840,7 @@ Bool TY_(SetXHTMLDocType)( TidyDocImpl* doc )
{ {
if (doctype) if (doctype)
TY_(DiscardElement)(doc, doctype); TY_(DiscardElement)(doc, doctype);
return yes; return aye;
} }
if (dtmode == TidyDoctypeUser && !cfgStr(doc, TidyDoctype)) if (dtmode == TidyDoctypeUser && !cfgStr(doc, TidyDoctype))
@ -1884,14 +1884,14 @@ Bool TY_(SetXHTMLDocType)( TidyDocImpl* doc )
case TidyDoctypeAuto: case TidyDoctypeAuto:
if (lexer->doctype == VERS_UNKNOWN || lexer->doctype == VERS_HTML5) { if (lexer->doctype == VERS_UNKNOWN || lexer->doctype == VERS_HTML5) {
lexer->versionEmitted = XH50; lexer->versionEmitted = XH50;
return yes; return aye;
} }
else if (lexer->versions & XH11 && lexer->doctype == XH11) else if (lexer->versions & XH11 && lexer->doctype == XH11)
{ {
if (!TY_(GetAttrByName)(doctype, sys)) if (!TY_(GetAttrByName)(doctype, sys))
TY_(RepairAttrValue)(doc, doctype, sys, GetSIFromVers(XH11)); TY_(RepairAttrValue)(doc, doctype, sys, GetSIFromVers(XH11));
lexer->versionEmitted = XH11; lexer->versionEmitted = XH11;
return yes; return aye;
} }
else if (lexer->versions & XH11 && !(lexer->versions & VERS_HTML40)) else if (lexer->versions & XH11 && !(lexer->versions & VERS_HTML40))
{ {
@ -1904,7 +1904,7 @@ Bool TY_(SetXHTMLDocType)( TidyDocImpl* doc )
if (!TY_(GetAttrByName)(doctype, sys)) if (!TY_(GetAttrByName)(doctype, sys))
TY_(RepairAttrValue)(doc, doctype, sys, GetSIFromVers(XB10)); TY_(RepairAttrValue)(doc, doctype, sys, GetSIFromVers(XB10));
lexer->versionEmitted = XB10; lexer->versionEmitted = XB10;
return yes; return aye;
} }
else if (lexer->versions & VERS_HTML40_STRICT) else if (lexer->versions & VERS_HTML40_STRICT)
{ {
@ -1958,13 +1958,13 @@ Bool TY_(FixDocType)( TidyDocImpl* doc )
uint guessed = VERS_UNKNOWN; uint guessed = VERS_UNKNOWN;
Bool hadSI = no; Bool hadSI = no;
/* Issue #167 - found doctype, and doctype is default VERS_HTML5, set VERS_HTML5 and return yes */ /* Issue #167 - found doctype, and doctype is default VERS_HTML5, set VERS_HTML5 and return aye */
if (doctype && (dtmode == TidyDoctypeAuto) && if (doctype && (dtmode == TidyDoctypeAuto) &&
(lexer->doctype == VERS_HTML5) ) (lexer->doctype == VERS_HTML5) )
{ {
/* The version emitted cannot be a composite value! */ /* The version emitted cannot be a composite value! */
lexer->versionEmitted = HT50; lexer->versionEmitted = HT50;
return yes; return aye;
} }
if (dtmode == TidyDoctypeAuto && if (dtmode == TidyDoctypeAuto &&
lexer->versions & lexer->doctype && lexer->versions & lexer->doctype &&
@ -1972,7 +1972,7 @@ Bool TY_(FixDocType)( TidyDocImpl* doc )
&& TY_(FindDocType)(doc)) && TY_(FindDocType)(doc))
{ {
lexer->versionEmitted = lexer->doctype; lexer->versionEmitted = lexer->doctype;
return yes; return aye;
} }
if (dtmode == TidyDoctypeOmit) if (dtmode == TidyDoctypeOmit)
@ -1980,11 +1980,11 @@ Bool TY_(FixDocType)( TidyDocImpl* doc )
if (doctype) if (doctype)
TY_(DiscardElement)( doc, doctype ); TY_(DiscardElement)( doc, doctype );
lexer->versionEmitted = TY_(ApparentVersion)( doc ); lexer->versionEmitted = TY_(ApparentVersion)( doc );
return yes; return aye;
} }
if (cfgBool(doc, TidyXmlOut)) if (cfgBool(doc, TidyXmlOut))
return yes; return aye;
if (doctype) if (doctype)
hadSI = TY_(GetAttrByName)(doctype, "SYSTEM") != NULL; hadSI = TY_(GetAttrByName)(doctype, "SYSTEM") != NULL;
@ -2031,7 +2031,7 @@ Bool TY_(FixDocType)( TidyDocImpl* doc )
if (hadSI) if (hadSI)
TY_(RepairAttrValue)(doc, doctype, "SYSTEM", GetSIFromVers(guessed)); TY_(RepairAttrValue)(doc, doctype, "SYSTEM", GetSIFromVers(guessed));
return yes; return aye;
} }
/* ensure XML document starts with <?xml version="1.0"?> */ /* ensure XML document starts with <?xml version="1.0"?> */
@ -2075,7 +2075,7 @@ Bool TY_(FixXmlDecl)( TidyDocImpl* doc )
if ( version == NULL ) if ( version == NULL )
TY_(AddAttribute)( doc, xml, "version", "1.0" ); TY_(AddAttribute)( doc, xml, "version", "1.0" );
return yes; return aye;
} }
Node* TY_(InferredTag)(TidyDocImpl* doc, TidyTagId id) Node* TY_(InferredTag)(TidyDocImpl* doc, TidyTagId id)
@ -2087,7 +2087,7 @@ Node* TY_(InferredTag)(TidyDocImpl* doc, TidyTagId id)
assert( dict != NULL ); assert( dict != NULL );
node->type = StartTag; node->type = StartTag;
node->implicit = yes; node->implicit = aye;
node->element = TY_(tmbstrdup)(doc->allocator, dict->name); node->element = TY_(tmbstrdup)(doc->allocator, dict->name);
node->tag = dict; node->tag = dict;
node->start = lexer->txtstart; node->start = lexer->txtstart;
@ -2103,12 +2103,12 @@ static Bool ExpectsContent(Node *node)
/* unknown element? */ /* unknown element? */
if (node->tag == NULL) if (node->tag == NULL)
return yes; return aye;
if (node->tag->model & CM_EMPTY) if (node->tag->model & CM_EMPTY)
return no; return no;
return yes; return aye;
} }
/* /*
@ -2131,15 +2131,15 @@ static Node *GetCDATA( TidyDocImpl* doc, Node *container )
int nested = 0; int nested = 0;
CDATAState state = CDATA_INTERMEDIATE; CDATAState state = CDATA_INTERMEDIATE;
uint i; uint i;
Bool isEmpty = yes; Bool isEmpty = aye;
Bool matches = no; Bool matches = no;
uint c; uint c;
Bool hasSrc = (TY_(AttrGetById)(container, TidyAttr_SRC) != NULL) ? yes : no; Bool hasSrc = (TY_(AttrGetById)(container, TidyAttr_SRC) != NULL) ? aye : no;
/*\ Issue #65 (1642186) and #280 - is script or style, and the option on /*\ Issue #65 (1642186) and #280 - is script or style, and the option on
* If yes, then avoid incrementing nested... * If aye, then avoid incrementing nested...
\*/ \*/
Bool nonested = ((nodeIsSCRIPT(container) || (nodeIsSTYLE(container))) && Bool nonested = ((nodeIsSCRIPT(container) || (nodeIsSTYLE(container))) &&
cfgBool(doc, TidySkipNested)) ? yes : no; cfgBool(doc, TidySkipNested)) ? aye : no;
SetLexerLocus( doc, lexer ); SetLexerLocus( doc, lexer );
lexer->waswhite = no; lexer->waswhite = no;
@ -2322,7 +2322,7 @@ static Node *GetCDATA( TidyDocImpl* doc, Node *container )
void TY_(UngetToken)( TidyDocImpl* doc ) void TY_(UngetToken)( TidyDocImpl* doc )
{ {
doc->lexer->pushed = yes; doc->lexer->pushed = aye;
} }
#ifdef TIDY_STORE_ORIGINAL_TEXT #ifdef TIDY_STORE_ORIGINAL_TEXT
@ -2454,7 +2454,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
if (lexer->insertspace) if (lexer->insertspace)
{ {
TY_(AddCharToLexer)(lexer, ' '); TY_(AddCharToLexer)(lexer, ' ');
lexer->waswhite = yes; lexer->waswhite = aye;
lexer->insertspace = no; lexer->insertspace = no;
} }
@ -2500,7 +2500,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
} }
else /* prev character wasn't white */ else /* prev character wasn't white */
{ {
lexer->waswhite = yes; lexer->waswhite = aye;
if (mode != Preformatted && mode != IgnoreMarkup && c != ' ') if (mode != Preformatted && mode != IgnoreMarkup && c != ' ')
ChangeChar(lexer, ' '); ChangeChar(lexer, ' ');
@ -2830,7 +2830,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
if (c != '\n' && c != '\f') if (c != '\n' && c != '\f')
TY_(UngetChar)(c, doc->docIn); TY_(UngetChar)(c, doc->docIn);
lexer->waswhite = yes; /* to swallow leading whitespace */ lexer->waswhite = aye; /* to swallow leading whitespace */
} }
else else
lexer->waswhite = no; lexer->waswhite = no;
@ -2846,7 +2846,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
TY_(ConstrainVersion)( doc, lexer->token->tag->versions ); TY_(ConstrainVersion)( doc, lexer->token->tag->versions );
TY_(RepairDuplicateAttributes)( doc, lexer->token, no ); TY_(RepairDuplicateAttributes)( doc, lexer->token, no );
} else } else
TY_(RepairDuplicateAttributes)( doc, lexer->token, yes ); TY_(RepairDuplicateAttributes)( doc, lexer->token, aye );
#ifdef TIDY_STORE_ORIGINAL_TEXT #ifdef TIDY_STORE_ORIGINAL_TEXT
StoreOriginalTextInToken(doc, lexer->token, 0); StoreOriginalTextInToken(doc, lexer->token, 0);
#endif #endif
@ -2886,7 +2886,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
c = TY_(ReadChar)(doc->docIn); c = TY_(ReadChar)(doc->docIn);
if (c == '\n') if (c == '\n')
lexer->token->linebreak = yes; lexer->token->linebreak = aye;
else else
TY_(UngetChar)(c, doc->docIn); TY_(UngetChar)(c, doc->docIn);
@ -3146,7 +3146,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
av = TY_(NewAttribute)(doc); av = TY_(NewAttribute)(doc);
av->attribute = name; av->attribute = name;
av->value = ParseValue( doc, name, yes, &isempty, &pdelim ); av->value = ParseValue( doc, name, aye, &isempty, &pdelim );
av->delim = pdelim; av->delim = pdelim;
av->dict = TY_(FindAttribute)( doc, av ); av->dict = TY_(FindAttribute)( doc, av );
@ -3460,7 +3460,7 @@ static tmbstr ParseAttribute( TidyDocImpl* doc, Bool *isempty,
if (c == '>') if (c == '>')
{ {
*isempty = yes; *isempty = aye;
return NULL; return NULL;
} }
@ -3582,7 +3582,7 @@ static int ParseServerInstruction( TidyDocImpl* doc )
/* check for ASP, PHP or Tango */ /* check for ASP, PHP or Tango */
if (c == '%' || c == '?' || c == '@') if (c == '%' || c == '?' || c == '@')
isrule = yes; isrule = aye;
for (;;) for (;;)
{ {
@ -3670,7 +3670,7 @@ static tmbstr ParseValue( TidyDocImpl* doc, ctmbstr name,
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
int len = 0, start; int len = 0, start;
Bool seen_gt = no; Bool seen_gt = no;
Bool munge = yes; Bool munge = aye;
uint c, lastc, delim, quotewarning; uint c, lastc, delim, quotewarning;
tmbstr value; tmbstr value;
@ -3821,7 +3821,7 @@ static tmbstr ParseValue( TidyDocImpl* doc, ctmbstr name,
if ( c == '>' && !TY_(IsUrl)(doc, name) ) if ( c == '>' && !TY_(IsUrl)(doc, name) )
{ {
*isempty = yes; *isempty = aye;
TY_(UngetChar)(c, doc->docIn); TY_(UngetChar)(c, doc->docIn);
break; break;
} }
@ -3840,7 +3840,7 @@ static tmbstr ParseValue( TidyDocImpl* doc, ctmbstr name,
++quotewarning; ++quotewarning;
if (c == '>') if (c == '>')
seen_gt = yes; seen_gt = aye;
} }
if (c == '&') if (c == '&')
@ -3924,7 +3924,7 @@ static tmbstr ParseValue( TidyDocImpl* doc, ctmbstr name,
if (len > 0 || delim) if (len > 0 || delim)
{ {
/* ignore leading and trailing white space for all but title, alt, value */ /* ignore leading and trailing white space for all but title, alt, value */
/* and prompts attributes unless --literal-attributes is set to yes */ /* and prompts attributes unless --literal-attributes is set to aye */
/* #994841 - Whitespace is removed from value attributes */ /* #994841 - Whitespace is removed from value attributes */
/* Issue #217 - Also only if/while (len > 0) - MUST NEVER GO NEGATIVE! */ /* Issue #217 - Also only if/while (len > 0) - MUST NEVER GO NEGATIVE! */
@ -3975,7 +3975,7 @@ static Bool IsValidAttrName( ctmbstr attr )
return no; return no;
} }
return yes; return aye;
} }
/* create a new attribute */ /* create a new attribute */
@ -4113,7 +4113,7 @@ static Node *ParseDocTypeDecl(TidyDocImpl* doc)
ParseDocTypeDeclState state = DT_DOCTYPENAME; ParseDocTypeDeclState state = DT_DOCTYPENAME;
uint c; uint c;
uint delim = 0; uint delim = 0;
Bool hasfpi = yes; Bool hasfpi = aye;
Node* node = TY_(NewNode)(lexer->allocator, lexer); Node* node = TY_(NewNode)(lexer->allocator, lexer);
node->type = DocTypeTag; node->type = DocTypeTag;
@ -4136,7 +4136,7 @@ static Node *ParseDocTypeDecl(TidyDocImpl* doc)
if (!lexer->waswhite) if (!lexer->waswhite)
{ {
TY_(AddCharToLexer)(lexer, c); TY_(AddCharToLexer)(lexer, c);
lexer->waswhite = yes; lexer->waswhite = aye;
} }
else else
{ {

2
src/mappedio.c

@ -322,7 +322,7 @@ int TY_(DocParseFileWithMappedFile)( TidyDocImpl* doc, ctmbstr filnam ) {
} }
status = TY_(DocParseStream)( doc, in ); status = TY_(DocParseStream)( doc, in );
freeMappedFileSource( &in->source, yes ); freeMappedFileSource( &in->source, aye );
TY_(freeStreamIn)( in ); TY_(freeStreamIn)( in );
} }
else /* Error message! */ else /* Error message! */

316
src/parser.c

File diff suppressed because it is too large

152
src/pprint.c

@ -1,6 +1,6 @@
/* /*
pprint.c -- pretty print parse tree pprint.c -- pretty print parse tree
(c) 1998-2007 (W3C) MIT, ERCIM, Keio University (c) 1998-2007 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice. See tidy.h for the copyright notice.
@ -51,8 +51,8 @@ static Bool ShouldIndent( TidyDocImpl* doc, Node *node );
/*\ /*\
* Issue #228 20150715 - macros to access --vertical-space tri state configuration parameter * Issue #228 20150715 - macros to access --vertical-space tri state configuration parameter
\*/ \*/
#define TidyClassicVS ((cfgAutoBool( doc, TidyVertSpace ) == TidyYesState) ? yes : no) #define TidyClassicVS ((cfgAutoBool( doc, TidyVertSpace ) == TidyYesState) ? aye : no)
#define TidyAddVS ((cfgAutoBool( doc, TidyVertSpace ) == TidyAutoState) ? no : yes ) #define TidyAddVS ((cfgAutoBool( doc, TidyVertSpace ) == TidyAutoState) ? no : aye )
/*\ /*\
* 20150515 - support using tabs instead of spaces - Issue #108 * 20150515 - support using tabs instead of spaces - Issue #108
@ -79,17 +79,17 @@ uint CWrapLen( TidyDocImpl* doc, uint ind )
uint wraplen = cfg( doc, TidyWrapLen ); uint wraplen = cfg( doc, TidyWrapLen );
if ( !TY_(tmbstrcasecmp)(lang, "zh") ) if ( !TY_(tmbstrcasecmp)(lang, "zh") )
/* Chinese characters take two positions on a fixed-width screen */ /* Chinese characters take two positions on a fixed-width screen */
/* It would be more accurate to keep a parallel linelen and wraphere /* It would be more accurate to keep a parallel linelen and wraphere
incremented by 2 for Chinese characters and 1 otherwise, but this incremented by 2 for Chinese characters and 1 otherwise, but this
is way simpler. is way simpler.
*/ */
return (ind + (( wraplen - ind ) / 2)) ; return (ind + (( wraplen - ind ) / 2)) ;
if ( !TY_(tmbstrcasecmp)(lang, "ja") ) if ( !TY_(tmbstrcasecmp)(lang, "ja") )
/* average Japanese text is 30% kanji */ /* average Japanese text is 30% kanji */
return (ind + ((( wraplen - ind ) * 7) / 10)) ; return (ind + ((( wraplen - ind ) * 7) / 10)) ;
return wraplen; return wraplen;
} }
#endif #endif
@ -114,7 +114,7 @@ typedef enum
U+2011 (non-breaking hyphen) U+2011 (non-breaking hyphen)
U+202F (narrow non-break space) U+202F (narrow non-break space)
U+2044 (fraction slash) U+2044 (fraction slash)
U+200B (zero width space) U+200B (zero width space)
...... (bidi formatting control characters) ...... (bidi formatting control characters)
@ -178,7 +178,7 @@ static struct _unicode4cat
{ 0x1801, UCPO }, { 0x1802, UCPO }, { 0x1803, UCPO }, { 0x1804, UCPO }, { 0x1801, UCPO }, { 0x1802, UCPO }, { 0x1803, UCPO }, { 0x1804, UCPO },
{ 0x1805, UCPO }, { 0x1806, UCPD }, { 0x1807, UCPO }, { 0x1808, UCPO }, { 0x1805, UCPO }, { 0x1806, UCPD }, { 0x1807, UCPO }, { 0x1808, UCPO },
{ 0x1809, UCPO }, { 0x180A, UCPO }, { 0x180E, UCZS }, { 0x1944, UCPO }, { 0x1809, UCPO }, { 0x180A, UCPO }, { 0x180E, UCZS }, { 0x1944, UCPO },
{ 0x1945, UCPO }, { 0x1945, UCPO },
#endif #endif
{ 0x2000, UCZS }, { 0x2001, UCZS }, { 0x2002, UCZS }, { 0x2003, UCZS }, { 0x2000, UCZS }, { 0x2001, UCZS }, { 0x2002, UCZS }, { 0x2003, UCZS },
{ 0x2004, UCZS }, { 0x2005, UCZS }, { 0x2006, UCZS }, { 0x2008, UCZS }, { 0x2004, UCZS }, { 0x2005, UCZS }, { 0x2006, UCZS }, { 0x2008, UCZS },
@ -300,9 +300,9 @@ static WrapPoint CharacterWrapPoint(tchar c)
static WrapPoint Big5WrapPoint(tchar c) static WrapPoint Big5WrapPoint(tchar c)
{ {
if ((c & 0xFF00) == 0xA100) if ((c & 0xFF00) == 0xA100)
{ {
/* opening brackets have odd codes: break before them */ /* opening brackets have odd codes: break before them */
if ( c > 0xA15C && c < 0xA1AD && (c & 1) == 1 ) if ( c > 0xA15C && c < 0xA1AD && (c & 1) == 1 )
return WrapBefore; return WrapBefore;
return WrapAfter; return WrapAfter;
} }
@ -346,7 +346,7 @@ static void expand( TidyPrintImpl* pprint, uint len )
ip = (uint*) TidyRealloc( pprint->allocator, pprint->linebuf, buflen*sizeof(uint) ); ip = (uint*) TidyRealloc( pprint->allocator, pprint->linebuf, buflen*sizeof(uint) );
if ( ip ) if ( ip )
{ {
TidyClearMemory( ip+pprint->lbufsize, TidyClearMemory( ip+pprint->lbufsize,
(buflen-pprint->lbufsize)*sizeof(uint) ); (buflen-pprint->lbufsize)*sizeof(uint) );
pprint->lbufsize = buflen; pprint->lbufsize = buflen;
pprint->linebuf = ip; pprint->linebuf = ip;
@ -372,7 +372,7 @@ static int ToggleInString( TidyPrintImpl* pprint )
static Bool IsInString( TidyPrintImpl* pprint ) static Bool IsInString( TidyPrintImpl* pprint )
{ {
TidyIndent *ind = pprint->indent + 0; /* Always 1st */ TidyIndent *ind = pprint->indent + 0; /* Always 1st */
return ( ind->attrStringStart >= 0 && return ( ind->attrStringStart >= 0 &&
ind->attrStringStart < (int) pprint->linelen ); ind->attrStringStart < (int) pprint->linelen );
} }
static Bool IsWrapInString( TidyPrintImpl* pprint ) static Bool IsWrapInString( TidyPrintImpl* pprint )
@ -392,7 +392,7 @@ static Bool HasMixedContent (Node *element)
for (node = element->content; node; node = node->next) for (node = element->content; node; node = node->next)
if ( TY_(nodeIsText)(node) ) if ( TY_(nodeIsText)(node) )
return yes; return aye;
return no; return no;
} }
@ -479,7 +479,7 @@ static uint AddString( TidyPrintImpl* pprint, ctmbstr str )
} }
/* Saves current output point as the wrap point, /* Saves current output point as the wrap point,
** but only if indentation would NOT overflow ** but only if indentation would NOT overflow
** the current line. Otherwise keep previous wrap point. ** the current line. Otherwise keep previous wrap point.
*/ */
static Bool SetWrap( TidyDocImpl* doc, uint indent ) static Bool SetWrap( TidyDocImpl* doc, uint indent )
@ -640,7 +640,7 @@ static Bool CheckWrapLine( TidyDocImpl* doc )
if ( GetSpaces(pprint) + pprint->linelen >= cfg(doc, TidyWrapLen) ) if ( GetSpaces(pprint) + pprint->linelen >= cfg(doc, TidyWrapLen) )
{ {
WrapLine( doc ); WrapLine( doc );
return yes; return aye;
} }
return no; return no;
} }
@ -655,10 +655,10 @@ static Bool CheckWrapIndent( TidyDocImpl* doc, uint indent )
{ {
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
} }
return yes; return aye;
} }
return no; return no;
} }
@ -727,7 +727,7 @@ void TY_(PFlushLine)( TidyDocImpl* doc, uint indent )
{ {
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
} }
} }
@ -749,7 +749,7 @@ static void PCondFlushLine( TidyDocImpl* doc, uint indent )
{ {
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
} }
} }
@ -777,7 +777,7 @@ void TY_(PFlushLineSmart)( TidyDocImpl* doc, uint indent )
{ {
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
} }
} }
@ -807,7 +807,7 @@ static void PCondFlushLineSmart( TidyDocImpl* doc, uint indent )
{ {
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
} }
} }
@ -851,7 +851,7 @@ static void PPrintChar( TidyDocImpl* doc, uint c, uint mode )
AddString( pprint, "&lt;" ); AddString( pprint, "&lt;" );
return; return;
} }
if ( c == '>') if ( c == '>')
{ {
AddString( pprint, "&gt;" ); AddString( pprint, "&gt;" );
@ -1043,7 +1043,7 @@ static uint IncrWS( uint start, uint end, uint indent, int ixWS )
} }
return start; return start;
} }
/* /*
The line buffer is uint not char so we can The line buffer is uint not char so we can
hold Unicode values unencoded. The translation hold Unicode values unencoded. The translation
to UTF-8 is deferred to the TY_(WriteChar)() routine called to UTF-8 is deferred to the TY_(WriteChar)() routine called
@ -1235,8 +1235,8 @@ static uint AttrIndent( TidyDocImpl* doc, Node* node, AttVal* ARG_UNUSED(attr) )
static Bool AttrNoIndentFirst( /*TidyDocImpl* doc,*/ Node* node, AttVal* attr ) static Bool AttrNoIndentFirst( /*TidyDocImpl* doc,*/ Node* node, AttVal* attr )
{ {
return ( attr==node->attributes ); return ( attr==node->attributes );
/*&& /*&&
( InsideHead(doc, node) || ( InsideHead(doc, node) ||
!TY_(nodeHasCM)(node, CM_INLINE) ) ); !TY_(nodeHasCM)(node, CM_INLINE) ) );
*/ */
@ -1279,7 +1279,7 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent,
if ( TY_(IsScript)(doc, name) ) if ( TY_(IsScript)(doc, name) )
wrappable = cfgBool( doc, TidyWrapScriptlets ); wrappable = cfgBool( doc, TidyWrapScriptlets );
else if (!(attrIsCONTENT(attr) || attrIsVALUE(attr) || attrIsALT(attr) || attrIsTITLE(attr)) && wrapAttrs ) else if (!(attrIsCONTENT(attr) || attrIsVALUE(attr) || attrIsALT(attr) || attrIsTITLE(attr)) && wrapAttrs )
wrappable = yes; wrappable = aye;
} }
if ( !first && !SetWrap(doc, indent) ) if ( !first && !SetWrap(doc, indent) )
@ -1307,7 +1307,7 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent,
/* fix for bug 732038 */ /* fix for bug 732038 */
#if 0 #if 0
/* If not indenting attributes, bump up indent for /* If not indenting attributes, bump up indent for
** value after putting out name. ** value after putting out name.
*/ */
if ( !indAttrs ) if ( !indAttrs )
@ -1315,7 +1315,7 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent,
#endif #endif
CheckWrapIndent( doc, indent ); CheckWrapIndent( doc, indent );
if ( attr->value == NULL ) if ( attr->value == NULL )
{ {
Bool isB = TY_(IsBoolAttribute)(attr); Bool isB = TY_(IsBoolAttribute)(attr);
@ -1326,9 +1326,9 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent,
attr->delim, no, scriptAttr ); attr->delim, no, scriptAttr );
else if ( !isB && !TY_(IsNewNode)(node) ) else if ( !isB && !TY_(IsNewNode)(node) )
PPrintAttrValue( doc, indent, "", attr->delim, yes, scriptAttr ); PPrintAttrValue( doc, indent, "", attr->delim, aye, scriptAttr );
else else
SetWrap( doc, indent ); SetWrap( doc, indent );
} }
else else
@ -1380,7 +1380,7 @@ Bool TY_(TextNodeEndWithSpace)( Lexer *lexer, Node *node )
} }
if ( c == ' ' || c == '\n' ) if ( c == ' ' || c == '\n' )
return yes; return aye;
} }
return no; return no;
} }
@ -1404,7 +1404,7 @@ static Bool AfterSpaceImp(Lexer *lexer, Node *node, Bool isEmpty)
Node *prev; Node *prev;
if ( !TY_(nodeCMIsInline)(node) ) if ( !TY_(nodeCMIsInline)(node) )
return yes; return aye;
prev = node->prev; prev = node->prev;
if (prev) if (prev)
@ -1412,7 +1412,7 @@ static Bool AfterSpaceImp(Lexer *lexer, Node *node, Bool isEmpty)
if (TY_(nodeIsText)(prev)) if (TY_(nodeIsText)(prev))
return TY_(TextNodeEndWithSpace)( lexer, prev ); return TY_(TextNodeEndWithSpace)( lexer, prev );
else if (nodeIsBR(prev)) else if (nodeIsBR(prev))
return yes; return aye;
return no; return no;
} }
@ -1455,41 +1455,41 @@ static Bool TY_(isVoidElement)( Node *node )
return no; return no;
id = node->tag->id; id = node->tag->id;
if (nodeIsAREA(node)) if (nodeIsAREA(node))
return yes; return aye;
if (nodeIsBASE(node)) if (nodeIsBASE(node))
return yes; return aye;
if (nodeIsBR(node)) if (nodeIsBR(node))
return yes; return aye;
if (nodeIsCOL(node)) if (nodeIsCOL(node))
return yes; return aye;
/* if (nodeIsCOMMAND(node)) */ /* if (nodeIsCOMMAND(node)) */
if (id == TidyTag_COMMAND) if (id == TidyTag_COMMAND)
return yes; return aye;
if (nodeIsEMBED(node)) if (nodeIsEMBED(node))
return yes; return aye;
if (nodeIsHR(node)) if (nodeIsHR(node))
return yes; return aye;
if (nodeIsIMG(node)) if (nodeIsIMG(node))
return yes; return aye;
if (nodeIsINPUT(node)) if (nodeIsINPUT(node))
return yes; return aye;
/* if (nodeIsKEYGEN(node)) */ /* if (nodeIsKEYGEN(node)) */
if (id == TidyTag_KEYGEN ) if (id == TidyTag_KEYGEN )
return yes; return aye;
if (nodeIsLINK(node)) if (nodeIsLINK(node))
return yes; return aye;
if (nodeIsMETA(node)) if (nodeIsMETA(node))
return yes; return aye;
if (nodeIsPARAM(node)) if (nodeIsPARAM(node))
return yes; return aye;
/* if (nodeIsSOURCE(node)) */ /* if (nodeIsSOURCE(node)) */
if (id == TidyTag_SOURCE ) if (id == TidyTag_SOURCE )
return yes; return aye;
/* if (nodeIsTRACK(node)) */ /* if (nodeIsTRACK(node)) */
if (id == TidyTag_TRACK ) if (id == TidyTag_TRACK )
return yes; return aye;
if (nodeIsWBR(node)) if (nodeIsWBR(node))
return yes; return aye;
return no; return no;
} }
@ -1587,7 +1587,7 @@ static void PPrintEndTag( TidyDocImpl* doc, uint ARG_UNUSED(mode),
/* /*
Netscape ignores SGML standard by not ignoring a Netscape ignores SGML standard by not ignoring a
line break before </A> or </U> etc. To avoid rendering line break before </A> or </U> etc. To avoid rendering
this as an underlined space, I disable line wrapping this as an underlined space, I disable line wrapping
before inline end tags by the #if 0 ... #endif before inline end tags by the #if 0 ... #endif
*/ */
@ -1898,7 +1898,7 @@ static ctmbstr DEFAULT_COMMENT_END = "";
static Bool InsideHead( TidyDocImpl* doc, Node *node ) static Bool InsideHead( TidyDocImpl* doc, Node *node )
{ {
if ( nodeIsHEAD(node) ) if ( nodeIsHEAD(node) )
return yes; return aye;
if ( node->parent != NULL ) if ( node->parent != NULL )
return InsideHead( doc, node->parent ); return InsideHead( doc, node->parent );
@ -1907,7 +1907,7 @@ static Bool InsideHead( TidyDocImpl* doc, Node *node )
} }
/* Is text node and already ends w/ a newline? /* Is text node and already ends w/ a newline?
Used to pretty print CDATA/PRE text content. Used to pretty print CDATA/PRE text content.
If it already ends on a newline, it is not If it already ends on a newline, it is not
necessary to print another before printing end tag. necessary to print another before printing end tag.
@ -1918,7 +1918,7 @@ static int TextEndsWithNewline(Lexer *lexer, Node *node, uint mode )
{ {
uint ch, ix = node->end - 1; uint ch, ix = node->end - 1;
/*\ /*\
* Skip non-newline whitespace. * Skip non-newline whitespace.
* Issue #379 - Only if ix is GT start can it be decremented! * Issue #379 - Only if ix is GT start can it be decremented!
\*/ \*/
while ( ix > node->start && (ch = (lexer->lexbuf[ix] & 0xff)) while ( ix > node->start && (ch = (lexer->lexbuf[ix] & 0xff))
@ -1937,15 +1937,15 @@ static int TextEndsWithNewline(Lexer *lexer, Node *node, uint mode )
* but this also applies to the AspTag, which is text like... * but this also applies to the AspTag, which is text like...
* And may apply to other text like nodes as well. * And may apply to other text like nodes as well.
* *
* Here the total white space is returned, and then a sister service, IncrWS() * Here the total white space is returned, and then a sister service, IncrWS()
* will advance the start of the lexer output by the amount of the indent. * will advance the start of the lexer output by the amount of the indent.
\*/ \*/
static Bool TY_(nodeIsTextLike)( Node *node ) static Bool TY_(nodeIsTextLike)( Node *node )
{ {
if ( TY_(nodeIsText)(node) ) if ( TY_(nodeIsText)(node) )
return yes; return aye;
if ( node->type == AspTag ) if ( node->type == AspTag )
return yes; return aye;
/* add other text like nodes... */ /* add other text like nodes... */
return no; return no;
} }
@ -2046,7 +2046,7 @@ void PPrintScriptStyle( TidyDocImpl* doc, uint mode, uint indent, Node *node )
be one child and the only caller of this function defines be one child and the only caller of this function defines
all these modes already... all these modes already...
*/ */
TY_(PPrintTree)( doc, (mode | PREFORMATTED | NOWRAP | CDATA), TY_(PPrintTree)( doc, (mode | PREFORMATTED | NOWRAP | CDATA),
indent, content ); indent, content );
if ( content == node->last ) if ( content == node->last )
@ -2078,7 +2078,7 @@ void PPrintScriptStyle( TidyDocImpl* doc, uint mode, uint indent, Node *node )
{ {
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
} }
PPrintEndTag( doc, mode, indent, node ); PPrintEndTag( doc, mode, indent, node );
@ -2105,7 +2105,7 @@ static Bool ShouldIndent( TidyDocImpl* doc, Node *node )
{ {
for ( node = node->content; node; node = node->next ) for ( node = node->content; node; node = node->next )
if ( TY_(nodeHasCM)(node, CM_BLOCK) ) if ( TY_(nodeHasCM)(node, CM_BLOCK) )
return yes; return aye;
return no; return no;
} }
@ -2128,10 +2128,10 @@ static Bool ShouldIndent( TidyDocImpl* doc, Node *node )
} }
if ( TY_(nodeHasCM)(node, CM_FIELD | CM_OBJECT) ) if ( TY_(nodeHasCM)(node, CM_FIELD | CM_OBJECT) )
return yes; return aye;
if ( nodeIsMAP(node) ) if ( nodeIsMAP(node) )
return yes; return aye;
return ( !TY_(nodeHasCM)( node, CM_INLINE ) && node->content ); return ( !TY_(nodeHasCM)( node, CM_INLINE ) && node->content );
} }
@ -2155,7 +2155,7 @@ void TY_(PrintBody)( TidyDocImpl* doc )
} }
} }
/* #130 MathML attr and entity fix! /* #130 MathML attr and entity fix!
Support MathML namepsace */ Support MathML namepsace */
static void PPrintMathML( TidyDocImpl* doc, uint indent, Node *node ) static void PPrintMathML( TidyDocImpl* doc, uint indent, Node *node )
{ {
@ -2222,7 +2222,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
else if ( TY_(nodeCMIsEmpty)(node) || else if ( TY_(nodeCMIsEmpty)(node) ||
(node->type == StartEndTag && !xhtml) ) (node->type == StartEndTag && !xhtml) )
{ {
/* Issue #8 - flush to new line? /* Issue #8 - flush to new line?
maybe use if ( TY_(nodeHasCM)(node, CM_BLOCK) ) instead maybe use if ( TY_(nodeHasCM)(node, CM_BLOCK) ) instead
or remove the CM_INLINE from the tag or remove the CM_INLINE from the tag
*/ */
@ -2260,7 +2260,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
if ( node->type == StartEndTag ) if ( node->type == StartEndTag )
node->type = StartTag; node->type = StartTag;
if ( node->tag && if ( node->tag &&
(node->tag->parser == TY_(ParsePre) || nodeIsTEXTAREA(node)) ) (node->tag->parser == TY_(ParsePre) || nodeIsTEXTAREA(node)) )
{ {
Bool classic = TidyClassicVS; /* #228 - cfgBool( doc, TidyVertSpace ); */ Bool classic = TidyClassicVS; /* #228 - cfgBool( doc, TidyVertSpace ); */
@ -2361,9 +2361,9 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
PCondFlushLineSmart( doc, indent ); PCondFlushLineSmart( doc, indent );
/*\ /*\
* Issue #180 - with the above PCondFlushLine, * Issue #180 - with the above PCondFlushLine,
* this adds an uneccessary additional line! * this adds an uneccessary additional line!
* Maybe only if 'classic' ie --vertical-space yes * Maybe only if 'classic' ie --vertical-space aye
\*/ \*/
if ( indsmart && node->prev != NULL && classic) if ( indsmart && node->prev != NULL && classic)
TY_(PFlushLineSmart)( doc, indent ); TY_(PFlushLineSmart)( doc, indent );
@ -2389,7 +2389,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
{ {
/*\ /*\
* Issue #180 - If the tag was NOT printed due to the -omit option, * Issue #180 - If the tag was NOT printed due to the -omit option,
* then reduce the bumped indent under the same ShouldIndent(doc, node) * then reduce the bumped indent under the same ShouldIndent(doc, node)
* conditions that caused the indent to be bumped. * conditions that caused the indent to be bumped.
\*/ \*/
contentIndent -= spaces; contentIndent -= spaces;
@ -2413,7 +2413,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
/* don't flush line for td and th */ /* don't flush line for td and th */
if ( ShouldIndent(doc, node) || if ( ShouldIndent(doc, node) ||
( !hideend && ( !hideend &&
( TY_(nodeHasCM)(node, CM_HTML) || ( TY_(nodeHasCM)(node, CM_HTML) ||
nodeIsNOFRAMES(node) || nodeIsNOFRAMES(node) ||
(TY_(nodeHasCM)(node, CM_HEAD) && !nodeIsTITLE(node)) (TY_(nodeHasCM)(node, CM_HEAD) && !nodeIsTITLE(node))
) )
@ -2444,7 +2444,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
{ {
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
} }
} }
@ -2468,7 +2468,7 @@ void TY_(PPrintXMLTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
{ {
doc->progressCallback( tidyImplToDoc(doc), node->line, node->column, doc->pprint.line + 1 ); doc->progressCallback( tidyImplToDoc(doc), node->line, node->column, doc->pprint.line + 1 );
} }
if ( node->type == TextNode) if ( node->type == TextNode)
{ {
PPrintText( doc, mode, indent, node ); PPrintText( doc, mode, indent, node );
@ -2521,7 +2521,7 @@ void TY_(PPrintXMLTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
{ {
if ( TY_(nodeIsText)(content) ) if ( TY_(nodeIsText)(content) )
{ {
mixed = yes; mixed = aye;
break; break;
} }
} }
@ -2542,7 +2542,7 @@ void TY_(PPrintXMLTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
PPrintTag( doc, mode, indent, node ); PPrintTag( doc, mode, indent, node );
if ( !mixed && node->content ) if ( !mixed && node->content )
TY_(PFlushLineSmart)( doc, cindent ); TY_(PFlushLineSmart)( doc, cindent );
for ( content = node->content; content; content = content->next ) for ( content = node->content; content; content = content->next )
TY_(PPrintXMLTree)( doc, mode, cindent, content ); TY_(PPrintXMLTree)( doc, mode, cindent, content );

12
src/streamio.c

@ -322,7 +322,7 @@ uint TY_(ReadChar)( StreamIn *in )
if (c == '\n') if (c == '\n')
{ {
#ifdef TIDY_STORE_ORIGINAL_TEXT #ifdef TIDY_STORE_ORIGINAL_TEXT
added = yes; added = aye;
TY_(AddCharToOriginalText)(in, (tchar)c); TY_(AddCharToOriginalText)(in, (tchar)c);
#endif #endif
in->curcol = 1; in->curcol = 1;
@ -333,7 +333,7 @@ uint TY_(ReadChar)( StreamIn *in )
if (c == '\t') if (c == '\t')
{ {
#ifdef TIDY_STORE_ORIGINAL_TEXT #ifdef TIDY_STORE_ORIGINAL_TEXT
added = yes; added = aye;
TY_(AddCharToOriginalText)(in, (tchar)c); TY_(AddCharToOriginalText)(in, (tchar)c);
#endif #endif
in->tabs = tabsize > 0 ? in->tabs = tabsize > 0 ?
@ -348,7 +348,7 @@ uint TY_(ReadChar)( StreamIn *in )
if (c == '\r') if (c == '\r')
{ {
#ifdef TIDY_STORE_ORIGINAL_TEXT #ifdef TIDY_STORE_ORIGINAL_TEXT
added = yes; added = aye;
TY_(AddCharToOriginalText)(in, (tchar)c); TY_(AddCharToOriginalText)(in, (tchar)c);
#endif #endif
c = ReadCharFromStream(in); c = ReadCharFromStream(in);
@ -410,7 +410,7 @@ uint TY_(ReadChar)( StreamIn *in )
if ( !TY_(IsValidUTF16FromUCS4)(c) ) if ( !TY_(IsValidUTF16FromUCS4)(c) )
{ {
/* invalid UTF-16 value */ /* invalid UTF-16 value */
TY_(ReportEncodingError)(in->doc, INVALID_UTF16, c, yes); TY_(ReportEncodingError)(in->doc, INVALID_UTF16, c, aye);
c = 0; c = 0;
} }
else if ( TY_(IsLowSurrogate)(c) ) else if ( TY_(IsLowSurrogate)(c) )
@ -429,7 +429,7 @@ uint TY_(ReadChar)( StreamIn *in )
} }
/* not a valid pair */ /* not a valid pair */
if ( 0 == c ) if ( 0 == c )
TY_(ReportEncodingError)( in->doc, INVALID_UTF16, c, yes ); TY_(ReportEncodingError)( in->doc, INVALID_UTF16, c, aye );
} }
} }
#endif #endif
@ -525,7 +525,7 @@ void TY_(UngetChar)( uint c, StreamIn *in )
return; return;
} }
in->pushed = yes; in->pushed = aye;
if (in->bufpos + 1 >= in->bufsize) if (in->bufpos + 1 >= in->bufsize)
in->charbuf = (tchar*)TidyRealloc(in->allocator, in->charbuf, sizeof(tchar) * ++(in->bufsize)); in->charbuf = (tchar*)TidyRealloc(in->allocator, in->charbuf, sizeof(tchar) * ++(in->bufsize));

34
src/tags.c

@ -159,11 +159,11 @@ static CheckAttribs CheckHTML;
#define VERS_ELEM_VIDEO (xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50) #define VERS_ELEM_VIDEO (xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50)
#define VERS_ELEM_WBR (xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50) #define VERS_ELEM_WBR (xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50)
/*\ /*\
* Issue #167 & #169 & #232 * Issue #167 & #169 & #232
* Tidy defaults to HTML5 mode * Tidy defaults to HTML5 mode
* but allow this table to be ADJUSTED if NOT HTML5 * but allow this table to be ADJUSTED if NOT HTML5
* was static const Dict tag_defs[] = * was static const Dict tag_defs[] =
\*/ \*/
static Dict tag_defs[] = static Dict tag_defs[] =
{ {
@ -493,7 +493,7 @@ static void declare( TidyDocImpl* doc, TidyTagImpl* tags,
} }
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
/* ==================================================================== /* ====================================================================
MSVC DEBUG ONLY MSVC DEBUG ONLY
*/ */
void ListElementsPerVersion( uint vers, Bool has ) void ListElementsPerVersion( uint vers, Bool has )
@ -538,7 +538,7 @@ void show_not_html5(void)
} }
void show_have_html5(void) void show_have_html5(void)
{ {
ListElementsPerVersion( VERS_HTML5, yes ); ListElementsPerVersion( VERS_HTML5, aye );
} }
#endif #endif
@ -550,13 +550,13 @@ Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
if ( cfgBool(doc, TidyXmlTags) ) if ( cfgBool(doc, TidyXmlTags) )
{ {
node->tag = doc->tags.xml_tags; node->tag = doc->tags.xml_tags;
return yes; return aye;
} }
if ( node->element && (np = tagsLookup(doc, &doc->tags, node->element)) ) if ( node->element && (np = tagsLookup(doc, &doc->tags, node->element)) )
{ {
node->tag = np; node->tag = np;
return yes; return aye;
} }
return no; return no;
@ -687,7 +687,7 @@ void TY_(FreeDeclaredTags)( TidyDocImpl* doc, UserTagType tagType )
for ( curr=tags->declared_tag_list; curr; curr = next ) for ( curr=tags->declared_tag_list; curr; curr = next )
{ {
Bool deleteIt = yes; Bool deleteIt = aye;
next = curr->next; next = curr->next;
switch ( tagType ) switch ( tagType )
{ {
@ -735,14 +735,14 @@ void TY_(FreeDeclaredTags)( TidyDocImpl* doc, UserTagType tagType )
* If the <!DOCTYPE ...> is found to NOT be HTML5, * If the <!DOCTYPE ...> is found to NOT be HTML5,
* then adjust tags to HTML4 mode * then adjust tags to HTML4 mode
* *
* NOTE: For each change added to here, there must * NOTE: For each change added to here, there must
* be a RESET added in TY_(ResetTags) below! * be a RESET added in TY_(ResetTags) below!
\*/ \*/
void TY_(AdjustTags)( TidyDocImpl *doc ) void TY_(AdjustTags)( TidyDocImpl *doc )
{ {
Dict *np = (Dict *)TY_(LookupTagDef)( TidyTag_A ); Dict *np = (Dict *)TY_(LookupTagDef)( TidyTag_A );
TidyTagImpl* tags = &doc->tags; TidyTagImpl* tags = &doc->tags;
if (np) if (np)
{ {
np->parser = TY_(ParseInline); np->parser = TY_(ParseInline);
np->model = CM_INLINE; np->model = CM_INLINE;
@ -796,7 +796,7 @@ void TY_(ResetTags)( TidyDocImpl *doc )
{ {
Dict *np = (Dict *)TY_(LookupTagDef)( TidyTag_A ); Dict *np = (Dict *)TY_(LookupTagDef)( TidyTag_A );
TidyTagImpl* tags = &doc->tags; TidyTagImpl* tags = &doc->tags;
if (np) if (np)
{ {
np->parser = TY_(ParseBlock); np->parser = TY_(ParseBlock);
np->model = (CM_INLINE|CM_BLOCK|CM_MIXED); np->model = (CM_INLINE|CM_BLOCK|CM_MIXED);
@ -815,7 +815,7 @@ void TY_(ResetTags)( TidyDocImpl *doc )
#if ELEMENT_HASH_LOOKUP #if ELEMENT_HASH_LOOKUP
tagsEmptyHash( doc, tags ); /* not sure this is really required, but to be sure */ tagsEmptyHash( doc, tags ); /* not sure this is really required, but to be sure */
#endif #endif
doc->HTML5Mode = yes; /* set HTML5 mode */ doc->HTML5Mode = aye; /* set HTML5 mode */
} }
void TY_(FreeTags)( TidyDocImpl* doc ) void TY_(FreeTags)( TidyDocImpl* doc )
@ -932,14 +932,14 @@ void CheckAREA( TidyDocImpl* doc, Node *node )
void CheckTABLE( TidyDocImpl* doc, Node *node ) void CheckTABLE( TidyDocImpl* doc, Node *node )
{ {
AttVal* attval; AttVal* attval;
Bool HasSummary = (TY_(AttrGetById)(node, TidyAttr_SUMMARY) != NULL) ? yes : no; Bool HasSummary = (TY_(AttrGetById)(node, TidyAttr_SUMMARY) != NULL) ? aye : no;
uint vers = TY_(HTMLVersion)(doc); /* Issue #377 - Also applies to XHTML5 */ uint vers = TY_(HTMLVersion)(doc); /* Issue #377 - Also applies to XHTML5 */
Bool isHTML5 = ((vers == HT50)||(vers == XH50)) ? yes : no; Bool isHTML5 = ((vers == HT50)||(vers == XH50)) ? aye : no;
TY_(CheckAttributes)(doc, node); TY_(CheckAttributes)(doc, node);
/* Issue #210 - a missing summary attribute is bad accessibility, no matter /* Issue #210 - a missing summary attribute is bad accessibility, no matter
what HTML version is involved; a document without is valid what HTML version is involved; a document without is valid
EXCEPT for HTML5, when to have a summary is wrong */ EXCEPT for HTML5, when to have a summary is wrong */
if (cfg(doc, TidyAccessibilityCheckLevel) == 0) if (cfg(doc, TidyAccessibilityCheckLevel) == 0)
{ {
@ -947,8 +947,8 @@ void CheckTABLE( TidyDocImpl* doc, Node *node )
{ {
/* #210 - has summary, and is HTML5, then report obsolete */ /* #210 - has summary, and is HTML5, then report obsolete */
TY_(ReportWarning)(doc, node, node, BAD_SUMMARY_HTML5); TY_(ReportWarning)(doc, node, node, BAD_SUMMARY_HTML5);
} }
else if (!HasSummary && !isHTML5) else if (!HasSummary && !isHTML5)
{ {
/* #210 - No summary, and NOT HTML5, then report as before */ /* #210 - No summary, and NOT HTML5, then report as before */
doc->badAccess |= BA_MISSING_SUMMARY; doc->badAccess |= BA_MISSING_SUMMARY;
@ -997,7 +997,7 @@ Bool TY_(nodeHasText)( TidyDocImpl* doc, Node* node )
{ {
/* whitespace */ /* whitespace */
if ( !TY_(IsWhite)( lexer->lexbuf[ix] ) ) if ( !TY_(IsWhite)( lexer->lexbuf[ix] ) )
return yes; return aye;
} }
} }
return no; return no;

58
src/tidy.h

@ -7,12 +7,12 @@
on any globals. Thus, thread-safety may be introduced w/out on any globals. Thus, thread-safety may be introduced w/out
changing the interface. changing the interface.
Looking ahead to a C++ wrapper, C functions always pass Looking ahead to a C++ wrapper, C functions always pass
this-equivalent as 1st arg. this-equivalent as 1st arg.
Copyright (c) 1998-2008 World Wide Web Consortium Copyright (c) 1998-2008 World Wide Web Consortium
(Massachusetts Institute of Technology, European Research (Massachusetts Institute of Technology, European Research
Consortium for Informatics and Mathematics, Keio University). Consortium for Informatics and Mathematics, Keio University).
All Rights Reserved. All Rights Reserved.
@ -21,18 +21,18 @@
Dave Raggett <dsr@w3.org> Dave Raggett <dsr@w3.org>
The contributing author(s) would like to thank all those who The contributing author(s) would like to thank all those who
helped with testing, bug fixes and suggestions for improvements. helped with testing, bug fixes and suggestions for improvements.
This wouldn't have been possible without your help. This wouldn't have been possible without your help.
COPYRIGHT NOTICE: COPYRIGHT NOTICE:
This software and documentation is provided "as is," and This software and documentation is provided "as is," and
the copyright holders and contributing author(s) make no the copyright holders and contributing author(s) make no
representations or warranties, express or implied, including representations or warranties, express or implied, including
but not limited to, warranties of merchantability or fitness but not limited to, warranties of merchantability or fitness
for any particular purpose or that the use of the software or for any particular purpose or that the use of the software or
documentation will not infringe any third party patents, documentation will not infringe any third party patents,
copyrights, trademarks or other rights. copyrights, trademarks or other rights.
The copyright holders and contributing author(s) will not be held The copyright holders and contributing author(s) will not be held
liable for any direct, indirect, special or consequential damages liable for any direct, indirect, special or consequential damages
@ -48,7 +48,7 @@
not be misrepresented as being the original source. not be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any 3. This Copyright notice may not be removed or altered from any
source or altered source distribution. source or altered source distribution.
The copyright holders and contributing author(s) specifically The copyright holders and contributing author(s) specifically
permit, without fee, and encourage the use of this source code permit, without fee, and encourage the use of this source code
as a component for supporting the Hypertext Markup Language in as a component for supporting the Hypertext Markup Language in
@ -145,7 +145,7 @@ typedef struct _TidyBuffer TidyBuffer;
** **
** In general, approximately 1/3rd of the memory ** In general, approximately 1/3rd of the memory
** used by tidy is freed during the parse, so if ** used by tidy is freed during the parse, so if
** memory usage is an issue then an allocator that ** memory usage is an issue then an allocator that
** can reuse this memory is a good idea. ** can reuse this memory is a good idea.
** **
** @{ ** @{
@ -174,7 +174,7 @@ struct _TidyAllocatorVtbl {
/** Called to free a previously allocated block of memory */ /** Called to free a previously allocated block of memory */
void (TIDY_CALL *free)( TidyAllocator *self, void *block); void (TIDY_CALL *free)( TidyAllocator *self, void *block);
/** Called when a panic condition is detected. Must support /** Called when a panic condition is detected. Must support
block == NULL. This function is not called if either alloc block == NULL. This function is not called if either alloc
or realloc fails; it is up to the allocator to do this. or realloc fails; it is up to the allocator to do this.
Currently this function can only be called if an error is Currently this function can only be called if an error is
detected in the tree integrity via the internal function detected in the tree integrity via the internal function
@ -193,7 +193,7 @@ struct _TidyAllocatorVtbl {
TidyAllocator base; TidyAllocator base;
...other custom allocator state... ...other custom allocator state...
} MyAllocator; } MyAllocator;
void* MyAllocator_alloc(TidyAllocator *base, void *block, size_t nBytes) void* MyAllocator_alloc(TidyAllocator *base, void *block, size_t nBytes)
{ {
MyAllocator *self = (MyAllocator*)base; MyAllocator *self = (MyAllocator*)base;
@ -258,7 +258,7 @@ TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic );
** >0 -> 1 == TIDY WARNING, 2 == TIDY ERROR ** >0 -> 1 == TIDY WARNING, 2 == TIDY ERROR
** <0 -> SEVERE ERROR ** <0 -> SEVERE ERROR
** </pre> ** </pre>
** **
The following is a short example program. The following is a short example program.
<pre> <pre>
@ -281,7 +281,7 @@ int main(int argc, char **argv )
tidyBufInit( &amp;errbuf ); tidyBufInit( &amp;errbuf );
printf( "Tidying:\t\%s\\n", input ); printf( "Tidying:\t\%s\\n", input );
ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML ok = tidyOptSetBool( tdoc, TidyXhtmlOut, aye ); // Convert to XHTML
if ( ok ) if ( ok )
rc = tidySetErrorBuffer( tdoc, &amp;errbuf ); // Capture diagnostics rc = tidySetErrorBuffer( tdoc, &amp;errbuf ); // Capture diagnostics
if ( rc &gt;= 0 ) if ( rc &gt;= 0 )
@ -291,7 +291,7 @@ int main(int argc, char **argv )
if ( rc &gt;= 0 ) if ( rc &gt;= 0 )
rc = tidyRunDiagnostics( tdoc ); // Kvetch rc = tidyRunDiagnostics( tdoc ); // Kvetch
if ( rc &gt; 1 ) // If error, force output. if ( rc &gt; 1 ) // If error, force output.
rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 ); rc = ( tidyOptSetBool(tdoc, TidyForceOutput, aye) ? rc : -1 );
if ( rc &gt;= 0 ) if ( rc &gt;= 0 )
rc = tidySaveBuffer( tdoc, &amp;output ); // Pretty Print rc = tidySaveBuffer( tdoc, &amp;output ); // Pretty Print
@ -337,7 +337,7 @@ TIDY_EXPORT void TIDY_CALL tidySetAppData( TidyDoc tdoc, void* appData );
/** Get application data set previously */ /** Get application data set previously */
TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc ); TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc );
/** Get release date (version) for current library /** Get release date (version) for current library
** @deprecated tidyReleaseDate() is deprecated in favor of semantic ** @deprecated tidyReleaseDate() is deprecated in favor of semantic
** versioning and should be replaced with tidyLibraryVersion(). ** versioning and should be replaced with tidyLibraryVersion().
*/ */
@ -413,7 +413,7 @@ TIDY_EXPORT int TIDY_CALL tidySetOutCharEncoding( TidyDoc tdoc, ctmbstr
*/ */
/** Applications using TidyLib may want to augment command-line and /** Applications using TidyLib may want to augment command-line and
** configuration file options. Setting this callback allows an application ** configuration file options. Setting this callback allows an application
** developer to examine command-line and configuration file options after ** developer to examine command-line and configuration file options after
** TidyLib has examined them and failed to recognize them. ** TidyLib has examined them and failed to recognize them.
**/ **/
@ -426,7 +426,7 @@ TIDY_EXPORT Bool TIDY_CALL tidySetOptionCallback( TidyDoc tdoc, TidyOpt
TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetIdForName( ctmbstr optnam ); TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetIdForName( ctmbstr optnam );
/** Get iterator for list of option */ /** Get iterator for list of option */
/** /**
Example: Example:
<pre> <pre>
TidyIterator itOpt = tidyGetOptionList( tdoc ); TidyIterator itOpt = tidyGetOptionList( tdoc );
@ -522,7 +522,7 @@ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetCurrPick( TidyDoc tdoc, TidyOption
TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc ); TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc );
/** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags, /** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags,
** TidyEmptyTags, TidyPreTags */ ** TidyEmptyTags, TidyPreTags */
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc, TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc,
TidyOptionId optId, TidyOptionId optId,
TidyIterator* iter ); TidyIterator* iter );
/** Get option description */ /** Get option description */
@ -539,8 +539,8 @@ TIDY_EXPORT TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc,
/** @defgroup IO I/O and Messages /** @defgroup IO I/O and Messages
** **
** By default, Tidy will define, create and use ** By default, Tidy will define, create and use
** instances of input and output handlers for ** instances of input and output handlers for
** standard C buffered I/O (i.e. FILE* stdin, ** standard C buffered I/O (i.e. FILE* stdin,
** FILE* stdout and FILE* stderr for content ** FILE* stdout and FILE* stderr for content
** input, content output and diagnostic output, ** input, content output and diagnostic output,
@ -623,7 +623,7 @@ typedef struct _TidyOutputSink
** an entry point to marshal pointers-to-functions. ** an entry point to marshal pointers-to-functions.
** Needed by .NET and possibly other language bindings. ** Needed by .NET and possibly other language bindings.
*/ */
TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink, TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink,
void* snkData, void* snkData,
TidyPutByteFunc pbFunc ); TidyPutByteFunc pbFunc );
@ -635,7 +635,7 @@ TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
Errors Errors
****************/ ****************/
/** Callback to filter messages by diagnostic level: /** Callback to filter messages by diagnostic level:
** info, warning, etc. Just set diagnostic output ** info, warning, etc. Just set diagnostic output
** handler to redirect all diagnostics output. Return true ** handler to redirect all diagnostics output. Return true
** to proceed with output, false to cancel. ** to proceed with output, false to cancel.
*/ */
@ -687,7 +687,7 @@ TIDY_EXPORT ctmbstr tidyLookupMessage( int errorNo );
/** @defgroup Parse Document Parse /** @defgroup Parse Document Parse
** **
** Parse markup from a given input source. String and filename ** Parse markup from a given input source. String and filename
** functions added for convenience. HTML/XHTML version determined ** functions added for convenience. HTML/XHTML version determined
** from input. ** from input.
** @{ ** @{
@ -718,7 +718,7 @@ TIDY_EXPORT int TIDY_CALL tidyParseSource( TidyDoc tdoc, TidyInputSource
/** Execute configured cleanup and repair operations on parsed markup */ /** Execute configured cleanup and repair operations on parsed markup */
TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc ); TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc );
/** Run configured diagnostics on parsed and repaired markup. /** Run configured diagnostics on parsed and repaired markup.
** Must call tidyCleanAndRepair() first. ** Must call tidyCleanAndRepair() first.
*/ */
TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc ); TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc );
@ -745,10 +745,10 @@ TIDY_EXPORT int TIDY_CALL tidySaveStdout( TidyDoc tdoc );
TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf ); TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf );
/** Save document to application buffer. If TidyShowMarkup and /** Save document to application buffer. If TidyShowMarkup and
** the document has no errors, or TidyForceOutput, the current ** the document has no errors, or TidyForceOutput, the current
** document, per the current configuration, will be Pretty Printed ** document, per the current configuration, will be Pretty Printed
** to the application buffer. The document byte length, ** to the application buffer. The document byte length,
** not character length, will be placed in *buflen. The document ** not character length, will be placed in *buflen. The document
** will not be null terminated. If the buffer is not big enough, ** will not be null terminated. If the buffer is not big enough,
** ENOMEM will be returned, else the actual document status. ** ENOMEM will be returned, else the actual document status.
*/ */
@ -773,7 +773,7 @@ TIDY_EXPORT int TIDY_CALL tidyOptSaveFile( TidyDoc tdoc, ctmbstr cfgfil
TIDY_EXPORT int TIDY_CALL tidyOptSaveSink( TidyDoc tdoc, TidyOutputSink* sink ); TIDY_EXPORT int TIDY_CALL tidyOptSaveSink( TidyDoc tdoc, TidyOutputSink* sink );
/* Error reporting functions /* Error reporting functions
*/ */
/** Write more complete information about errors to current error sink. */ /** Write more complete information about errors to current error sink. */
@ -910,7 +910,7 @@ TIDY_EXPORT uint TIDY_CALL tidyNodeColumn( TidyNode tnod );
/** @defgroup NodeIsElementName Deprecated node interrogation per TagId /** @defgroup NodeIsElementName Deprecated node interrogation per TagId
** **
** @deprecated The functions tidyNodeIs{ElementName} are deprecated and ** @deprecated The functions tidyNodeIs{ElementName} are deprecated and
** should be replaced by tidyNodeGetId. ** should be replaced by tidyNodeGetId.
** @{ ** @{
*/ */
@ -1016,7 +1016,7 @@ TIDY_EXPORT Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr );
/** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId /** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId
** **
** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and ** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and
** should be replaced by tidyAttrGetId. ** should be replaced by tidyAttrGetId.
** @{ ** @{
*/ */
@ -1081,9 +1081,9 @@ TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetById( TidyNode tnod, TidyAttrId attId
/** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId /** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId
** **
** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and ** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and
** should be replaced by tidyAttrGetById. ** should be replaced by tidyAttrGetById.
** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by ** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by
** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential ** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential
** name clash with tidyAttrGetId for case-insensitive languages. ** name clash with tidyAttrGetId for case-insensitive languages.
** @{ ** @{

12
src/tidyenum.h

@ -150,11 +150,11 @@ typedef enum
TidyWrapPhp, /**< Wrap within PHP pseudo elements */ TidyWrapPhp, /**< Wrap within PHP pseudo elements */
TidyFixBackslash, /**< Fix URLs by replacing \ with / */ TidyFixBackslash, /**< Fix URLs by replacing \ with / */
TidyIndentAttributes,/**< Newline+indent before each attribute */ TidyIndentAttributes,/**< Newline+indent before each attribute */
TidyXmlPIs, /**< If set to yes PIs must end with ?> */ TidyXmlPIs, /**< If set to aye PIs must end with ?> */
TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */ TidyXmlSpace, /**< If set to aye adds xml:space attr as needed */
TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */ TidyEncloseBodyText, /**< If aye text at body is wrapped in P's */
TidyEncloseBlockText,/**< If yes text in blocks is wrapped in P's */ TidyEncloseBlockText,/**< If aye text in blocks is wrapped in P's */
TidyKeepFileTimes, /**< If yes last modied time is preserved */ TidyKeepFileTimes, /**< If aye last modied time is preserved */
TidyWord2000, /**< Draconian cleaning for Word2000 */ TidyWord2000, /**< Draconian cleaning for Word2000 */
TidyMark, /**< Add meta element indicating tidied doc */ TidyMark, /**< Add meta element indicating tidied doc */
TidyEmacs, /**< If true format error output for GNU Emacs */ TidyEmacs, /**< If true format error output for GNU Emacs */
@ -233,7 +233,7 @@ typedef enum
typedef enum typedef enum
{ {
TidyNoState, /**< maps to 'no' */ TidyNoState, /**< maps to 'no' */
TidyYesState, /**< maps to 'yes' */ TidyYesState, /**< maps to 'aye' */
TidyAutoState /**< Automatic */ TidyAutoState /**< Automatic */
} TidyTriState; } TidyTriState;

66
src/tidylib.c

@ -222,7 +222,7 @@ Bool TIDY_CALL tidySetOptionCallback( TidyDoc tdoc, TidyOptCallback pOptC
if ( impl ) if ( impl )
{ {
impl->pOptCallback = pOptCallback; impl->pOptCallback = pOptCallback;
return yes; return aye;
} }
return no; return no;
} }
@ -371,7 +371,7 @@ Bool TIDY_CALL tidyOptGetDefaultBool( TidyOption topt )
{ {
const TidyOptionImpl* option = tidyOptionToImpl( topt ); const TidyOptionImpl* option = tidyOptionToImpl( topt );
if ( option && option->type != TidyString ) if ( option && option->type != TidyString )
return ( option->dflt ? yes : no ); return ( option->dflt ? aye : no );
return no; return no;
} }
Bool TIDY_CALL tidyOptIsReadOnly( TidyOption topt ) Bool TIDY_CALL tidyOptIsReadOnly( TidyOption topt )
@ -379,7 +379,7 @@ Bool TIDY_CALL tidyOptIsReadOnly( TidyOption topt )
const TidyOptionImpl* option = tidyOptionToImpl( topt ); const TidyOptionImpl* option = tidyOptionToImpl( topt );
if ( option ) if ( option )
return ( option->parser == NULL ); return ( option->parser == NULL );
return yes; return aye;
} }
@ -569,7 +569,7 @@ Bool TIDY_CALL tidyOptSnapshot( TidyDoc tdoc )
if ( impl ) if ( impl )
{ {
TY_(TakeConfigSnapshot)( impl ); TY_(TakeConfigSnapshot)( impl );
return yes; return aye;
} }
return no; return no;
} }
@ -579,7 +579,7 @@ Bool TIDY_CALL tidyOptResetToSnapshot( TidyDoc tdoc )
if ( impl ) if ( impl )
{ {
TY_(ResetConfigToSnapshot)( impl ); TY_(ResetConfigToSnapshot)( impl );
return yes; return aye;
} }
return no; return no;
} }
@ -589,7 +589,7 @@ Bool TIDY_CALL tidyOptResetAllToDefault( TidyDoc tdoc )
if ( impl ) if ( impl )
{ {
TY_(ResetConfigToDefault)( impl ); TY_(ResetConfigToDefault)( impl );
return yes; return aye;
} }
return no; return no;
} }
@ -624,7 +624,7 @@ Bool TIDY_CALL tidyOptCopyConfig( TidyDoc to, TidyDoc from )
if ( docTo && docFrom ) if ( docTo && docFrom )
{ {
TY_(CopyConfig)( docTo, docFrom ); TY_(CopyConfig)( docTo, docFrom );
return yes; return aye;
} }
return no; return no;
} }
@ -653,7 +653,7 @@ Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc, TidyReportFilter filt )
if ( impl ) if ( impl )
{ {
impl->mssgFilt = filt; impl->mssgFilt = filt;
return yes; return aye;
} }
return no; return no;
} }
@ -669,7 +669,7 @@ Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc, TidyReportFilter2 filt
if ( impl ) if ( impl )
{ {
impl->mssgFilt2 = filt; impl->mssgFilt2 = filt;
return yes; return aye;
} }
return no; return no;
} }
@ -685,7 +685,7 @@ Bool TIDY_CALL tidySetReportFilter3( TidyDoc tdoc, TidyReportFilter3 filt
if ( impl ) if ( impl )
{ {
impl->mssgFilt3 = filt; impl->mssgFilt3 = filt;
return yes; return aye;
} }
return no; return no;
} }
@ -782,7 +782,7 @@ Bool TIDY_CALL tidySetPrettyPrinterCallback(TidyDoc tdoc, TidyPPProgress
if ( impl ) if ( impl )
{ {
impl->progressCallback = callback; impl->progressCallback = callback;
return yes; return aye;
} }
return no; return no;
} }
@ -929,7 +929,7 @@ int tidyDocParseFile( TidyDocImpl* doc, ctmbstr filnam )
return status; return status;
} }
status = TY_(DocParseStream)( doc, in ); status = TY_(DocParseStream)( doc, in );
TY_(freeFileSource)(&in->source, yes); TY_(freeFileSource)(&in->source, aye);
TY_(freeStreamIn)(in); TY_(freeStreamIn)(in);
} }
else /* Error message! */ else /* Error message! */
@ -1300,7 +1300,7 @@ static void list_not_html5(void)
{ {
static Bool done_list = no; static Bool done_list = no;
if (done_list == no) { if (done_list == no) {
done_list = yes; done_list = aye;
show_not_html5(); show_not_html5();
} }
} }
@ -1333,7 +1333,7 @@ Bool inRemovedInfo( uint tid )
if (html5Info[i].tag == 0) if (html5Info[i].tag == 0)
break; break;
if (html5Info[i].id == tid) if (html5Info[i].id == tid)
return yes; return aye;
} }
return no; return no;
} }
@ -1358,14 +1358,14 @@ static Bool nodeHasAlignAttr( Node *node )
AttVal* av; AttVal* av;
for ( av = node->attributes; av != NULL; av = av->next ) { for ( av = node->attributes; av != NULL; av = av->next ) {
if (attrIsALIGN(av)) if (attrIsALIGN(av))
return yes; return aye;
} }
return no; return no;
} }
/* /*
* Perform special checks for HTML, even when we're not using the default * Perform special checks for HTML, even when we're not using the default
* option `--strict-tags-attributes yes`. This will ensure that HTML5 warning * option `--strict-tags-attributes aye`. This will ensure that HTML5 warning
* and error output is given regardless of the new option, and ensure that * and error output is given regardless of the new option, and ensure that
* cleanup takes place. This provides mostly consistent Tidy behavior even with * cleanup takes place. This provides mostly consistent Tidy behavior even with
* the introduction of this new option. Note that strings have changed, though, * the introduction of this new option. Note that strings have changed, though,
@ -1379,7 +1379,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
Bool clean = cfgBool( doc, TidyMakeClean ); Bool clean = cfgBool( doc, TidyMakeClean );
Bool already_strict = cfgBool( doc, TidyStrictTagsAttr ); Bool already_strict = cfgBool( doc, TidyStrictTagsAttr );
Node* body = TY_(FindBody)( doc ); Node* body = TY_(FindBody)( doc );
Bool warn = yes; /* should this be a warning, error, or report??? */ Bool warn = aye; /* should this be a warning, error, or report??? */
AttVal* attr = NULL; AttVal* attr = NULL;
int i = 0; int i = 0;
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
@ -1393,7 +1393,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
*/ */
/* We will only emit this message if `--strict-tags-attributes==no`; /* We will only emit this message if `--strict-tags-attributes==no`;
* otherwise if yes this message will be output during later * otherwise if aye this message will be output during later
* checking. * checking.
*/ */
if ( !already_strict ) if ( !already_strict )
@ -1402,7 +1402,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
if ( node == body ) { if ( node == body ) {
i = 0; i = 0;
/* We will only emit these messages if `--strict-tags-attributes==no`; /* We will only emit these messages if `--strict-tags-attributes==no`;
* otherwise if yes these messages will be output during later * otherwise if aye these messages will be output during later
* checking. * checking.
*/ */
if ( !already_strict ) { if ( !already_strict ) {
@ -1572,7 +1572,7 @@ void TY_(CheckHTMLTagsAttribsVersions)( TidyDocImpl* doc, Node* node )
Bool check_versions = cfgBool( doc, TidyStrictTagsAttr ); Bool check_versions = cfgBool( doc, TidyStrictTagsAttr );
AttVal *next_attr, *attval; AttVal *next_attr, *attval;
Bool attrIsProprietary = no; Bool attrIsProprietary = no;
Bool attrIsMismatched = yes; Bool attrIsMismatched = aye;
while (node) while (node)
{ {
@ -1864,16 +1864,16 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc )
if (xhtmlOut && !htmlOut) if (xhtmlOut && !htmlOut)
{ {
TY_(SetXHTMLDocType)(doc); TY_(SetXHTMLDocType)(doc);
TY_(FixAnchors)(doc, &doc->root, wantNameAttr, yes); TY_(FixAnchors)(doc, &doc->root, wantNameAttr, aye);
TY_(FixXhtmlNamespace)(doc, yes); TY_(FixXhtmlNamespace)(doc, aye);
TY_(FixLanguageInformation)(doc, &doc->root, yes, yes); TY_(FixLanguageInformation)(doc, &doc->root, aye, aye);
} }
else else
{ {
TY_(FixDocType)(doc); TY_(FixDocType)(doc);
TY_(FixAnchors)(doc, &doc->root, wantNameAttr, yes); TY_(FixAnchors)(doc, &doc->root, wantNameAttr, aye);
TY_(FixXhtmlNamespace)(doc, no); TY_(FixXhtmlNamespace)(doc, no);
TY_(FixLanguageInformation)(doc, &doc->root, no, yes); TY_(FixLanguageInformation)(doc, &doc->root, no, aye);
} }
if (tidyMark ) if (tidyMark )
@ -1918,11 +1918,11 @@ Bool showBodyOnly( TidyDocImpl* doc, TidyTriState bodyOnly )
case TidyNoState: case TidyNoState:
return no; return no;
case TidyYesState: case TidyYesState:
return yes; return aye;
default: default:
node = TY_(FindBody)( doc ); node = TY_(FindBody)( doc );
if (node && node->implicit ) if (node && node->implicit )
return yes; return aye;
} }
return no; return no;
} }
@ -1990,7 +1990,7 @@ int tidyDocSaveStream( TidyDocImpl* doc, StreamOut* out )
** which gives you only the basic character entities, ** which gives you only the basic character entities,
** which are safe in any browser. ** which are safe in any browser.
** if ( !TY_(FindDocType)(doc) ) ** if ( !TY_(FindDocType)(doc) )
** TY_(SetOptionBool)( doc, TidyNumEntities, yes ); ** TY_(SetOptionBool)( doc, TidyNumEntities, aye );
*/ */
doc->docOut = out; doc->docOut = out;
@ -2156,7 +2156,7 @@ Bool TIDY_CALL tidyNodeGetText( TidyDoc tdoc, TidyNode tnod, TidyBuffer* outbuf
doc->docOut = NULL; doc->docOut = NULL;
TidyDocFree( doc, out ); TidyDocFree( doc, out );
return yes; return aye;
} }
return no; return no;
} }
@ -2188,13 +2188,13 @@ Bool TIDY_CALL tidyNodeGetValue( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf )
return no; return no;
} }
return yes; return aye;
} }
Bool TIDY_CALL tidyNodeIsProp( TidyDoc ARG_UNUSED(tdoc), TidyNode tnod ) Bool TIDY_CALL tidyNodeIsProp( TidyDoc ARG_UNUSED(tdoc), TidyNode tnod )
{ {
Node* nimp = tidyNodeToImpl( tnod ); Node* nimp = tidyNodeToImpl( tnod );
Bool isProprietary = yes; Bool isProprietary = aye;
if ( nimp ) if ( nimp )
{ {
switch ( nimp->type ) switch ( nimp->type )
@ -2213,7 +2213,7 @@ Bool TIDY_CALL tidyNodeIsProp( TidyDoc ARG_UNUSED(tdoc), TidyNode tnod )
case AspTag: case AspTag:
case JsteTag: case JsteTag:
case PhpTag: case PhpTag:
isProprietary = yes; isProprietary = aye;
break; break;
case StartTag: case StartTag:
@ -2221,7 +2221,7 @@ Bool TIDY_CALL tidyNodeIsProp( TidyDoc ARG_UNUSED(tdoc), TidyNode tnod )
case StartEndTag: case StartEndTag:
isProprietary = ( nimp->tag isProprietary = ( nimp->tag
? (nimp->tag->versions&VERS_PROPRIETARY)!=0 ? (nimp->tag->versions&VERS_PROPRIETARY)!=0
: yes ); : aye );
break; break;
} }
} }

36
src/tidyplatform.h

@ -24,17 +24,17 @@ extern "C" {
/* /*
Uncomment the following #define if you are on a system Uncomment the following #define if you are on a system
supporting the HOME environment variable. supporting the HOME environment variable.
It enables tidy to find config files named ~/.tidyrc if It enables tidy to find config files named ~/.tidyrc if
the HTML_TIDY environment variable is not set. the HTML_TIDY environment variable is not set.
*/ */
/* #define TIDY_USER_CONFIG_FILE "~/.tidyrc" */ /* #define TIDY_USER_CONFIG_FILE "~/.tidyrc" */
/* /*
Uncomment the following #define if your Uncomment the following #define if your
system supports the call getpwnam(). system supports the call getpwnam().
E.g. Unix and Linux. E.g. Unix and Linux.
It enables tidy to find files named It enables tidy to find files named
~your/foo for use in the HTML_TIDY environment ~your/foo for use in the HTML_TIDY environment
variable or CONFIG_FILE or USER_CONFIGFILE or variable or CONFIG_FILE or USER_CONFIGFILE or
on the command line: -config ~joebob/tidy.cfg on the command line: -config ~joebob/tidy.cfg
@ -100,7 +100,7 @@ extern "C" {
#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
@ -140,7 +140,7 @@ extern "C" {
#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
@ -174,7 +174,7 @@ extern "C" {
#endif #endif
/* Convenience defines for Linux platforms */ /* 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
@ -227,7 +227,7 @@ extern "C" {
#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
@ -380,10 +380,10 @@ extern "C" {
If your platform doesn't support <utime.h> and the If your platform doesn't support <utime.h> and the
utime() function, or <sys/futime> and the futime() utime() function, or <sys/futime> and the futime()
function then set PRESERVE_FILE_TIMES to 0. function then set PRESERVE_FILE_TIMES to 0.
If your platform doesn't support <sys/utime.h> and the If your platform doesn't support <sys/utime.h> and the
futime() function, then set HAS_FUTIME to 0. futime() function, then set HAS_FUTIME to 0.
If your platform supports <utime.h> and the If your platform supports <utime.h> and the
utime() function requires the file to be utime() function requires the file to be
closed first, then set UTIME_NEEDS_CLOSED_FILE to 1. closed first, then set UTIME_NEEDS_CLOSED_FILE to 1.
@ -422,7 +422,7 @@ extern "C" {
#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>
@ -437,7 +437,7 @@ extern "C" {
/* /*
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.
@ -458,7 +458,7 @@ extern "C" {
/* /*
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).
WINDOWS automatically set by Win16 compilers. WINDOWS automatically set by Win16 compilers.
_WIN32 automatically set by Win32 compilers. _WIN32 automatically set by Win32 compilers.
*/ */
@ -492,9 +492,9 @@ extern "C" {
#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
@ -525,7 +525,7 @@ typedef unsigned long ulong;
#endif #endif
/* /*
With GCC 4, __attribute__ ((visibility("default"))) can be used along compiling with tidylib 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. with "-fvisibility=hidden". See http://gcc.gnu.org/wiki/Visibility and build/gmake/Makefile.
*/ */
/* /*
@ -535,7 +535,7 @@ with "-fvisibility=hidden". See http://gcc.gnu.org/wiki/Visibility and build/gma
*/ */
#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
@ -588,10 +588,10 @@ typedef _Bool Bool;
typedef enum typedef enum
{ {
no, no,
yes aye
} Bool; } Bool;
/* for NULL pointers /* for NULL pointers
#define null ((const void*)0) #define null ((const void*)0)
extern void* null; extern void* null;
*/ */

84
src/utf8.c

@ -10,12 +10,12 @@
Note, UTF-8 encoding, by itself, does not affect the actual Note, UTF-8 encoding, by itself, does not affect the actual
"codepoints" of the underlying character encoding. In the "codepoints" of the underlying character encoding. In the
cases of ASCII, Latin1, Unicode (16-bit, BMP), these all cases of ASCII, Latin1, Unicode (16-bit, BMP), these all
refer to ISO-10646 "codepoints". For anything else, they refer to ISO-10646 "codepoints". For anything else, they
refer to some other "codepoint" set. refer to some other "codepoint" set.
Put another way, UTF-8 is a variable length method to Put another way, UTF-8 is a variable length method to
represent any non-negative integer value. The glyph represent any non-negative integer value. The glyph
that a integer value represents is unchanged and defined that a integer value represents is unchanged and defined
externally (e.g. by ISO-10646, Big5, Win1252, MacRoman, externally (e.g. by ISO-10646, Big5, Win1252, MacRoman,
Latin2-9, and so on). Latin2-9, and so on).
@ -28,7 +28,7 @@
#include "forward.h" #include "forward.h"
#include "utf8.h" #include "utf8.h"
/* /*
UTF-8 encoding/decoding functions UTF-8 encoding/decoding functions
Return # of bytes in UTF-8 sequence; result < 0 if illegal sequence Return # of bytes in UTF-8 sequence; result < 0 if illegal sequence
@ -105,7 +105,7 @@ DBBF DFF* F3 BF BF B* 000FFFF*
DBFF DFF* F4 8F BF B* 0010FFF* DBFF DFF* F4 8F BF B* 0010FFF*
* = E or F * = E or F
1010 A 1010 A
1011 B 1011 B
1100 C 1100 C
@ -158,7 +158,7 @@ static const struct validUTF8Sequence
{0x1000, 0xFFFF, 3, {0xE1, 0xEF, 0x80, 0xBF, 0x80, 0xBF, 0x00, 0x00}}, {0x1000, 0xFFFF, 3, {0xE1, 0xEF, 0x80, 0xBF, 0x80, 0xBF, 0x00, 0x00}},
{0x10000, 0x3FFFF, 4, {0xF0, 0xF0, 0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF}}, {0x10000, 0x3FFFF, 4, {0xF0, 0xF0, 0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF}},
{0x40000, 0xFFFFF, 4, {0xF1, 0xF3, 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF}}, {0x40000, 0xFFFFF, 4, {0xF1, 0xF3, 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF}},
{0x100000, 0x10FFFF, 4, {0xF4, 0xF4, 0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF}} {0x100000, 0x10FFFF, 4, {0xF4, 0xF4, 0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF}}
}; };
int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes, int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes,
@ -169,10 +169,10 @@ int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes,
uint ch = 0, n = 0; uint ch = 0, n = 0;
int i, bytes = 0; int i, bytes = 0;
Bool hasError = no; Bool hasError = no;
if ( successorBytes ) if ( successorBytes )
buf = (byte*) successorBytes; buf = (byte*) successorBytes;
/* special check if we have been passed an EOF char */ /* special check if we have been passed an EOF char */
if ( firstByte == EndOfStream ) if ( firstByte == EndOfStream )
{ {
@ -183,7 +183,7 @@ int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes,
} }
ch = firstByte; /* first byte is passed in separately */ ch = firstByte; /* first byte is passed in separately */
if (ch <= 0x7F) /* 0XXX XXXX one byte */ if (ch <= 0x7F) /* 0XXX XXXX one byte */
{ {
n = ch; n = ch;
@ -208,20 +208,20 @@ int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes,
{ {
n = ch & 3; n = ch & 3;
bytes = 5; bytes = 5;
hasError = yes; hasError = aye;
} }
else if ((ch & 0xFE) == 0xFC) /* 1111 110X six bytes */ else if ((ch & 0xFE) == 0xFC) /* 1111 110X six bytes */
{ {
n = ch & 1; n = ch & 1;
bytes = 6; bytes = 6;
hasError = yes; hasError = aye;
} }
else else
{ {
/* not a valid first byte of a UTF-8 sequence */ /* not a valid first byte of a UTF-8 sequence */
n = ch; n = ch;
bytes = 1; bytes = 1;
hasError = yes; hasError = aye;
} }
/* successor bytes should have the form 10XX XXXX */ /* successor bytes should have the form 10XX XXXX */
@ -235,7 +235,7 @@ int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes,
{ {
if ( !buf[i] || (buf[i] & 0xC0) != 0x80 ) if ( !buf[i] || (buf[i] & 0xC0) != 0x80 )
{ {
hasError = yes; hasError = aye;
bytes = i+1; bytes = i+1;
break; break;
} }
@ -252,7 +252,7 @@ int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes,
/* End of data or illegal successor byte value */ /* End of data or illegal successor byte value */
if ( b == EOF || (buf[i] & 0xC0) != 0x80 ) if ( b == EOF || (buf[i] & 0xC0) != 0x80 )
{ {
hasError = yes; hasError = aye;
bytes = i+1; bytes = i+1;
if ( b != EOF ) if ( b != EOF )
inp->ungetByte( inp->sourceData, buf[i] ); inp->ungetByte( inp->sourceData, buf[i] );
@ -263,48 +263,48 @@ int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes,
} }
else if ( bytes > 1 ) else if ( bytes > 1 )
{ {
hasError = yes; hasError = aye;
bytes = 1; bytes = 1;
} }
if (!hasError && ((n == kUTF8ByteSwapNotAChar) || (n == kUTF8NotAChar))) if (!hasError && ((n == kUTF8ByteSwapNotAChar) || (n == kUTF8NotAChar)))
hasError = yes; hasError = aye;
if (!hasError && (n > kMaxUTF8FromUCS4)) if (!hasError && (n > kMaxUTF8FromUCS4))
hasError = yes; hasError = aye;
#if 0 /* Breaks Big5 D8 - DF */ #if 0 /* Breaks Big5 D8 - DF */
if (!hasError && (n >= kUTF16LowSurrogateBegin) && (n <= kUTF16HighSurrogateEnd)) if (!hasError && (n >= kUTF16LowSurrogateBegin) && (n <= kUTF16HighSurrogateEnd))
/* unpaired surrogates not allowed */ /* unpaired surrogates not allowed */
hasError = yes; hasError = aye;
#endif #endif
if (!hasError) if (!hasError)
{ {
int lo, hi; int lo, hi;
lo = offsetUTF8Sequences[bytes - 1]; lo = offsetUTF8Sequences[bytes - 1];
hi = offsetUTF8Sequences[bytes] - 1; hi = offsetUTF8Sequences[bytes] - 1;
/* check for overlong sequences */ /* check for overlong sequences */
if ((n < validUTF8[lo].lowChar) || (n > validUTF8[hi].highChar)) if ((n < validUTF8[lo].lowChar) || (n > validUTF8[hi].highChar))
hasError = yes; hasError = aye;
else else
{ {
hasError = yes; /* assume error until proven otherwise */ hasError = aye; /* assume error until proven otherwise */
for (i = lo; i <= hi; i++) for (i = lo; i <= hi; i++)
{ {
int tempCount; int tempCount;
byte theByte; byte theByte;
for (tempCount = 0; tempCount < bytes; tempCount++) for (tempCount = 0; tempCount < bytes; tempCount++)
{ {
if (!tempCount) if (!tempCount)
theByte = (tmbchar) firstByte; theByte = (tmbchar) firstByte;
else else
theByte = buf[tempCount - 1]; theByte = buf[tempCount - 1];
if ( theByte >= validUTF8[i].validBytes[(tempCount * 2)] && if ( theByte >= validUTF8[i].validBytes[(tempCount * 2)] &&
theByte <= validUTF8[i].validBytes[(tempCount * 2) + 1] ) theByte <= validUTF8[i].validBytes[(tempCount * 2) + 1] )
hasError = no; hasError = no;
@ -341,10 +341,10 @@ int TY_(EncodeCharToUTF8Bytes)( uint c, tmbstr encodebuf,
byte* buf = &tempbuf[0]; byte* buf = &tempbuf[0];
int bytes = 0; int bytes = 0;
Bool hasError = no; Bool hasError = no;
if ( encodebuf ) if ( encodebuf )
buf = (byte*) encodebuf; buf = (byte*) encodebuf;
if (c <= 0x7F) /* 0XXX XXXX one byte */ if (c <= 0x7F) /* 0XXX XXXX one byte */
{ {
buf[0] = (tmbchar) c; buf[0] = (tmbchar) c;
@ -363,11 +363,11 @@ int TY_(EncodeCharToUTF8Bytes)( uint c, tmbstr encodebuf,
buf[2] = (tmbchar) (0x80 | (c & 0x3F)); buf[2] = (tmbchar) (0x80 | (c & 0x3F));
bytes = 3; bytes = 3;
if ( c == kUTF8ByteSwapNotAChar || c == kUTF8NotAChar ) if ( c == kUTF8ByteSwapNotAChar || c == kUTF8NotAChar )
hasError = yes; hasError = aye;
#if 0 /* Breaks Big5 D8 - DF */ #if 0 /* Breaks Big5 D8 - DF */
else if ( c >= kUTF16LowSurrogateBegin && c <= kUTF16HighSurrogateEnd ) else if ( c >= kUTF16LowSurrogateBegin && c <= kUTF16HighSurrogateEnd )
/* unpaired surrogates not allowed */ /* unpaired surrogates not allowed */
hasError = yes; hasError = aye;
#endif #endif
} }
else if (c <= 0x1FFFFF) /* 1111 0XXX four bytes */ else if (c <= 0x1FFFFF) /* 1111 0XXX four bytes */
@ -378,7 +378,7 @@ int TY_(EncodeCharToUTF8Bytes)( uint c, tmbstr encodebuf,
buf[3] = (tmbchar) (0x80 | (c & 0x3F)); buf[3] = (tmbchar) (0x80 | (c & 0x3F));
bytes = 4; bytes = 4;
if (c > kMaxUTF8FromUCS4) if (c > kMaxUTF8FromUCS4)
hasError = yes; hasError = aye;
} }
else if (c <= 0x3FFFFFF) /* 1111 10XX five bytes */ else if (c <= 0x3FFFFFF) /* 1111 10XX five bytes */
{ {
@ -388,7 +388,7 @@ int TY_(EncodeCharToUTF8Bytes)( uint c, tmbstr encodebuf,
buf[3] = (tmbchar) (0x80 | ((c >> 6) & 0x3F)); buf[3] = (tmbchar) (0x80 | ((c >> 6) & 0x3F));
buf[4] = (tmbchar) (0x80 | (c & 0x3F)); buf[4] = (tmbchar) (0x80 | (c & 0x3F));
bytes = 5; bytes = 5;
hasError = yes; hasError = aye;
} }
else if (c <= 0x7FFFFFFF) /* 1111 110X six bytes */ else if (c <= 0x7FFFFFFF) /* 1111 110X six bytes */
{ {
@ -399,11 +399,11 @@ int TY_(EncodeCharToUTF8Bytes)( uint c, tmbstr encodebuf,
buf[4] = (tmbchar) (0x80 | ((c >> 6) & 0x3F)); buf[4] = (tmbchar) (0x80 | ((c >> 6) & 0x3F));
buf[5] = (tmbchar) (0x80 | (c & 0x3F)); buf[5] = (tmbchar) (0x80 | (c & 0x3F));
bytes = 6; bytes = 6;
hasError = yes; hasError = aye;
} }
else else
hasError = yes; hasError = aye;
/* don't output invalid UTF-8 byte sequence to a stream */ /* don't output invalid UTF-8 byte sequence to a stream */
if ( !hasError && outp != NULL ) if ( !hasError && outp != NULL )
{ {
@ -422,7 +422,7 @@ int TY_(EncodeCharToUTF8Bytes)( uint c, tmbstr encodebuf,
fprintf( stderr, "\n" ); fprintf( stderr, "\n" );
} }
#endif #endif
*count = bytes; *count = bytes;
if (hasError) if (hasError)
return -1; return -1;
@ -439,9 +439,9 @@ uint TY_(GetUTF8)( ctmbstr str, uint *ch )
int bytes; int bytes;
int err; int err;
bytes = 0; bytes = 0;
/* first byte "str[0]" is passed in separately from the */ /* first byte "str[0]" is passed in separately from the */
/* rest of the UTF-8 byte sequence starting at "str[1]" */ /* rest of the UTF-8 byte sequence starting at "str[1]" */
err = TY_(DecodeUTF8BytesToChar)( &n, str[0], str+1, NULL, &bytes ); err = TY_(DecodeUTF8BytesToChar)( &n, str[0], str+1, NULL, &bytes );
@ -461,7 +461,7 @@ uint TY_(GetUTF8)( ctmbstr str, uint *ch )
tmbstr TY_(PutUTF8)( tmbstr buf, uint c ) tmbstr TY_(PutUTF8)( tmbstr buf, uint c )
{ {
int err, count = 0; int err, count = 0;
err = TY_(EncodeCharToUTF8Bytes)( c, buf, NULL, &count ); err = TY_(EncodeCharToUTF8Bytes)( c, buf, NULL, &count );
if (err) if (err)
{ {
@ -474,7 +474,7 @@ tmbstr TY_(PutUTF8)( tmbstr buf, uint c )
buf[2] = (byte) 0xBD; buf[2] = (byte) 0xBD;
count = 3; count = 3;
} }
buf += count; buf += count;
return buf; return buf;
} }
@ -496,7 +496,7 @@ Bool TY_(IsLowSurrogate)( tchar ch )
tchar TY_(CombineSurrogatePair)( tchar high, tchar low ) tchar TY_(CombineSurrogatePair)( tchar high, tchar low )
{ {
assert( TY_(IsHighSurrogate)(high) && TY_(IsLowSurrogate)(low) ); assert( TY_(IsHighSurrogate)(high) && TY_(IsLowSurrogate)(low) );
return ( ((low - kUTF16LowSurrogateBegin) * 0x400) + return ( ((low - kUTF16LowSurrogateBegin) * 0x400) +
high - kUTF16HighSurrogateBegin + 0x10000 ); high - kUTF16HighSurrogateBegin + 0x10000 );
} }

792
src/win32tc.c

@ -59,364 +59,364 @@ static struct _nameWinCPMap
uint wincp; uint wincp;
Bool safe; Bool safe;
} const NameWinCPMap[] = { } const NameWinCPMap[] = {
{ "cp037", 37, yes }, { "cp037", 37, aye },
{ "csibm037", 37, yes }, { "csibm037", 37, aye },
{ "ebcdic-cp-ca", 37, yes }, { "ebcdic-cp-ca", 37, aye },
{ "ebcdic-cp-nl", 37, yes }, { "ebcdic-cp-nl", 37, aye },
{ "ebcdic-cp-us", 37, yes }, { "ebcdic-cp-us", 37, aye },
{ "ebcdic-cp-wt", 37, yes }, { "ebcdic-cp-wt", 37, aye },
{ "ibm037", 37, yes }, { "ibm037", 37, aye },
{ "cp437", 437, yes }, { "cp437", 437, aye },
{ "cspc8codepage437", 437, yes }, { "cspc8codepage437", 437, aye },
{ "ibm437", 437, yes }, { "ibm437", 437, aye },
{ "cp500", 500, yes }, { "cp500", 500, aye },
{ "csibm500", 500, yes }, { "csibm500", 500, aye },
{ "ebcdic-cp-be", 500, yes }, { "ebcdic-cp-be", 500, aye },
{ "ebcdic-cp-ch", 500, yes }, { "ebcdic-cp-ch", 500, aye },
{ "ibm500", 500, yes }, { "ibm500", 500, aye },
{ "asmo-708", 708, yes }, { "asmo-708", 708, aye },
{ "dos-720", 720, yes }, { "dos-720", 720, aye },
{ "ibm737", 737, yes }, { "ibm737", 737, aye },
{ "ibm775", 775, yes }, { "ibm775", 775, aye },
{ "cp850", 850, yes }, { "cp850", 850, aye },
{ "ibm850", 850, yes }, { "ibm850", 850, aye },
{ "cp852", 852, yes }, { "cp852", 852, aye },
{ "ibm852", 852, yes }, { "ibm852", 852, aye },
{ "cp855", 855, yes }, { "cp855", 855, aye },
{ "ibm855", 855, yes }, { "ibm855", 855, aye },
{ "cp857", 857, yes }, { "cp857", 857, aye },
{ "ibm857", 857, yes }, { "ibm857", 857, aye },
{ "ccsid00858", 858, yes }, { "ccsid00858", 858, aye },
{ "cp00858", 858, yes }, { "cp00858", 858, aye },
{ "cp858", 858, yes }, { "cp858", 858, aye },
{ "ibm00858", 858, yes }, { "ibm00858", 858, aye },
{ "pc-multilingual-850+euro", 858, yes }, { "pc-multilingual-850+euro", 858, aye },
{ "cp860", 860, yes }, { "cp860", 860, aye },
{ "ibm860", 860, yes }, { "ibm860", 860, aye },
{ "cp861", 861, yes }, { "cp861", 861, aye },
{ "ibm861", 861, yes }, { "ibm861", 861, aye },
{ "cp862", 862, yes }, { "cp862", 862, aye },
{ "dos-862", 862, yes }, { "dos-862", 862, aye },
{ "ibm862", 862, yes }, { "ibm862", 862, aye },
{ "cp863", 863, yes }, { "cp863", 863, aye },
{ "ibm863", 863, yes }, { "ibm863", 863, aye },
{ "cp864", 864, yes }, { "cp864", 864, aye },
{ "ibm864", 864, yes }, { "ibm864", 864, aye },
{ "cp865", 865, yes }, { "cp865", 865, aye },
{ "ibm865", 865, yes }, { "ibm865", 865, aye },
{ "cp866", 866, yes }, { "cp866", 866, aye },
{ "ibm866", 866, yes }, { "ibm866", 866, aye },
{ "cp869", 869, yes }, { "cp869", 869, aye },
{ "ibm869", 869, yes }, { "ibm869", 869, aye },
{ "cp870", 870, yes }, { "cp870", 870, aye },
{ "csibm870", 870, yes }, { "csibm870", 870, aye },
{ "ebcdic-cp-roece", 870, yes }, { "ebcdic-cp-roece", 870, aye },
{ "ebcdic-cp-yu", 870, yes }, { "ebcdic-cp-yu", 870, aye },
{ "ibm870", 870, yes }, { "ibm870", 870, aye },
{ "dos-874", 874, yes }, { "dos-874", 874, aye },
{ "iso-8859-11", 874, yes }, { "iso-8859-11", 874, aye },
{ "tis-620", 874, yes }, { "tis-620", 874, aye },
{ "windows-874", 874, yes }, { "windows-874", 874, aye },
{ "cp875", 875, yes }, { "cp875", 875, aye },
{ "csshiftjis", 932, yes }, { "csshiftjis", 932, aye },
{ "cswindows31j", 932, yes }, { "cswindows31j", 932, aye },
{ "ms_kanji", 932, yes }, { "ms_kanji", 932, aye },
{ "shift-jis", 932, yes }, { "shift-jis", 932, aye },
{ "shift_jis", 932, yes }, { "shift_jis", 932, aye },
{ "sjis", 932, yes }, { "sjis", 932, aye },
{ "x-ms-cp932", 932, yes }, { "x-ms-cp932", 932, aye },
{ "x-sjis", 932, yes }, { "x-sjis", 932, aye },
{ "chinese", 936, yes }, { "chinese", 936, aye },
{ "cn-gb", 936, yes }, { "cn-gb", 936, aye },
{ "csgb2312", 936, yes }, { "csgb2312", 936, aye },
{ "csgb231280", 936, yes }, { "csgb231280", 936, aye },
{ "csiso58gb231280", 936, yes }, { "csiso58gb231280", 936, aye },
{ "gb2312", 936, yes }, { "gb2312", 936, aye },
{ "gb2312-80", 936, yes }, { "gb2312-80", 936, aye },
{ "gb231280", 936, yes }, { "gb231280", 936, aye },
{ "gb_2312-80", 936, yes }, { "gb_2312-80", 936, aye },
{ "gbk", 936, yes }, { "gbk", 936, aye },
{ "iso-ir-58", 936, yes }, { "iso-ir-58", 936, aye },
{ "csksc56011987", 949, yes }, { "csksc56011987", 949, aye },
{ "iso-ir-149", 949, yes }, { "iso-ir-149", 949, aye },
{ "korean", 949, yes }, { "korean", 949, aye },
{ "ks-c-5601", 949, yes }, { "ks-c-5601", 949, aye },
{ "ks-c5601", 949, yes }, { "ks-c5601", 949, aye },
{ "ks_c_5601", 949, yes }, { "ks_c_5601", 949, aye },
{ "ks_c_5601-1987", 949, yes }, { "ks_c_5601-1987", 949, aye },
{ "ks_c_5601-1989", 949, yes }, { "ks_c_5601-1989", 949, aye },
{ "ks_c_5601_1987", 949, yes }, { "ks_c_5601_1987", 949, aye },
{ "ksc5601", 949, yes }, { "ksc5601", 949, aye },
{ "ksc_5601", 949, yes }, { "ksc_5601", 949, aye },
{ "big5", 950, yes }, { "big5", 950, aye },
{ "big5-hkscs", 950, yes }, { "big5-hkscs", 950, aye },
{ "cn-big5", 950, yes }, { "cn-big5", 950, aye },
{ "csbig5", 950, yes }, { "csbig5", 950, aye },
{ "x-x-big5", 950, yes }, { "x-x-big5", 950, aye },
{ "cp1026", 1026, yes }, { "cp1026", 1026, aye },
{ "csibm1026", 1026, yes }, { "csibm1026", 1026, aye },
{ "ibm1026", 1026, yes }, { "ibm1026", 1026, aye },
{ "ibm01047", 1047, yes }, { "ibm01047", 1047, aye },
{ "ccsid01140", 1140, yes }, { "ccsid01140", 1140, aye },
{ "cp01140", 1140, yes }, { "cp01140", 1140, aye },
{ "ebcdic-us-37+euro", 1140, yes }, { "ebcdic-us-37+euro", 1140, aye },
{ "ibm01140", 1140, yes }, { "ibm01140", 1140, aye },
{ "ccsid01141", 1141, yes }, { "ccsid01141", 1141, aye },
{ "cp01141", 1141, yes }, { "cp01141", 1141, aye },
{ "ebcdic-de-273+euro", 1141, yes }, { "ebcdic-de-273+euro", 1141, aye },
{ "ibm01141", 1141, yes }, { "ibm01141", 1141, aye },
{ "ccsid01142", 1142, yes }, { "ccsid01142", 1142, aye },
{ "cp01142", 1142, yes }, { "cp01142", 1142, aye },
{ "ebcdic-dk-277+euro", 1142, yes }, { "ebcdic-dk-277+euro", 1142, aye },
{ "ebcdic-no-277+euro", 1142, yes }, { "ebcdic-no-277+euro", 1142, aye },
{ "ibm01142", 1142, yes }, { "ibm01142", 1142, aye },
{ "ccsid01143", 1143, yes }, { "ccsid01143", 1143, aye },
{ "cp01143", 1143, yes }, { "cp01143", 1143, aye },
{ "ebcdic-fi-278+euro", 1143, yes }, { "ebcdic-fi-278+euro", 1143, aye },
{ "ebcdic-se-278+euro", 1143, yes }, { "ebcdic-se-278+euro", 1143, aye },
{ "ibm01143", 1143, yes }, { "ibm01143", 1143, aye },
{ "ccsid01144", 1144, yes }, { "ccsid01144", 1144, aye },
{ "cp01144", 1144, yes }, { "cp01144", 1144, aye },
{ "ebcdic-it-280+euro", 1144, yes }, { "ebcdic-it-280+euro", 1144, aye },
{ "ibm01144", 1144, yes }, { "ibm01144", 1144, aye },
{ "ccsid01145", 1145, yes }, { "ccsid01145", 1145, aye },
{ "cp01145", 1145, yes }, { "cp01145", 1145, aye },
{ "ebcdic-es-284+euro", 1145, yes }, { "ebcdic-es-284+euro", 1145, aye },
{ "ibm01145", 1145, yes }, { "ibm01145", 1145, aye },
{ "ccsid01146", 1146, yes }, { "ccsid01146", 1146, aye },
{ "cp01146", 1146, yes }, { "cp01146", 1146, aye },
{ "ebcdic-gb-285+euro", 1146, yes }, { "ebcdic-gb-285+euro", 1146, aye },
{ "ibm01146", 1146, yes }, { "ibm01146", 1146, aye },
{ "ccsid01147", 1147, yes }, { "ccsid01147", 1147, aye },
{ "cp01147", 1147, yes }, { "cp01147", 1147, aye },
{ "ebcdic-fr-297+euro", 1147, yes }, { "ebcdic-fr-297+euro", 1147, aye },
{ "ibm01147", 1147, yes }, { "ibm01147", 1147, aye },
{ "ccsid01148", 1148, yes }, { "ccsid01148", 1148, aye },
{ "cp01148", 1148, yes }, { "cp01148", 1148, aye },
{ "ebcdic-international-500+euro", 1148, yes }, { "ebcdic-international-500+euro", 1148, aye },
{ "ibm01148", 1148, yes }, { "ibm01148", 1148, aye },
{ "ccsid01149", 1149, yes }, { "ccsid01149", 1149, aye },
{ "cp01149", 1149, yes }, { "cp01149", 1149, aye },
{ "ebcdic-is-871+euro", 1149, yes }, { "ebcdic-is-871+euro", 1149, aye },
{ "ibm01149", 1149, yes }, { "ibm01149", 1149, aye },
{ "iso-10646-ucs-2", 1200, yes }, { "iso-10646-ucs-2", 1200, aye },
{ "ucs-2", 1200, yes }, { "ucs-2", 1200, aye },
{ "unicode", 1200, yes }, { "unicode", 1200, aye },
{ "utf-16", 1200, yes }, { "utf-16", 1200, aye },
{ "utf-16le", 1200, yes }, { "utf-16le", 1200, aye },
{ "unicodefffe", 1201, yes }, { "unicodefffe", 1201, aye },
{ "utf-16be", 1201, yes }, { "utf-16be", 1201, aye },
{ "windows-1250", 1250, yes }, { "windows-1250", 1250, aye },
{ "x-cp1250", 1250, yes }, { "x-cp1250", 1250, aye },
{ "windows-1251", 1251, yes }, { "windows-1251", 1251, aye },
{ "x-cp1251", 1251, yes }, { "x-cp1251", 1251, aye },
{ "windows-1252", 1252, yes }, { "windows-1252", 1252, aye },
{ "x-ansi", 1252, yes }, { "x-ansi", 1252, aye },
{ "windows-1253", 1253, yes }, { "windows-1253", 1253, aye },
{ "windows-1254", 1254, yes }, { "windows-1254", 1254, aye },
{ "windows-1255", 1255, yes }, { "windows-1255", 1255, aye },
{ "cp1256", 1256, yes }, { "cp1256", 1256, aye },
{ "windows-1256", 1256, yes }, { "windows-1256", 1256, aye },
{ "windows-1257", 1257, yes }, { "windows-1257", 1257, aye },
{ "windows-1258", 1258, yes }, { "windows-1258", 1258, aye },
{ "johab", 1361, yes }, { "johab", 1361, aye },
{ "macintosh", 10000, yes }, { "macintosh", 10000, aye },
{ "x-mac-japanese", 10001, yes }, { "x-mac-japanese", 10001, aye },
{ "x-mac-chinesetrad", 10002, yes }, { "x-mac-chinesetrad", 10002, aye },
{ "x-mac-korean", 10003, yes }, { "x-mac-korean", 10003, aye },
{ "x-mac-arabic", 10004, yes }, { "x-mac-arabic", 10004, aye },
{ "x-mac-hebrew", 10005, yes }, { "x-mac-hebrew", 10005, aye },
{ "x-mac-greek", 10006, yes }, { "x-mac-greek", 10006, aye },
{ "x-mac-cyrillic", 10007, yes }, { "x-mac-cyrillic", 10007, aye },
{ "x-mac-chinesesimp", 10008, yes }, { "x-mac-chinesesimp", 10008, aye },
{ "x-mac-romanian", 10010, yes }, { "x-mac-romanian", 10010, aye },
{ "x-mac-ukrainian", 10017, yes }, { "x-mac-ukrainian", 10017, aye },
{ "x-mac-thai", 10021, yes }, { "x-mac-thai", 10021, aye },
{ "x-mac-ce", 10029, yes }, { "x-mac-ce", 10029, aye },
{ "x-mac-icelandic", 10079, yes }, { "x-mac-icelandic", 10079, aye },
{ "x-mac-turkish", 10081, yes }, { "x-mac-turkish", 10081, aye },
{ "x-mac-croatian", 10082, yes }, { "x-mac-croatian", 10082, aye },
{ "x-chinese-cns", 20000, yes }, { "x-chinese-cns", 20000, aye },
{ "x-cp20001", 20001, yes }, { "x-cp20001", 20001, aye },
{ "x-chinese-eten", 20002, yes }, { "x-chinese-eten", 20002, aye },
{ "x-cp20003", 20003, yes }, { "x-cp20003", 20003, aye },
{ "x-cp20004", 20004, yes }, { "x-cp20004", 20004, aye },
{ "x-cp20005", 20005, yes }, { "x-cp20005", 20005, aye },
{ "irv", 20105, yes }, { "irv", 20105, aye },
{ "x-ia5", 20105, yes }, { "x-ia5", 20105, aye },
{ "din_66003", 20106, yes }, { "din_66003", 20106, aye },
{ "german", 20106, yes }, { "german", 20106, aye },
{ "x-ia5-german", 20106, yes }, { "x-ia5-german", 20106, aye },
{ "sen_850200_b", 20107, yes }, { "sen_850200_b", 20107, aye },
{ "swedish", 20107, yes }, { "swedish", 20107, aye },
{ "x-ia5-swedish", 20107, yes }, { "x-ia5-swedish", 20107, aye },
{ "norwegian", 20108, yes }, { "norwegian", 20108, aye },
{ "ns_4551-1", 20108, yes }, { "ns_4551-1", 20108, aye },
{ "x-ia5-norwegian", 20108, yes }, { "x-ia5-norwegian", 20108, aye },
{ "ansi_x3.4-1968", 20127, yes }, { "ansi_x3.4-1968", 20127, aye },
{ "ansi_x3.4-1986", 20127, yes }, { "ansi_x3.4-1986", 20127, aye },
{ "ascii", 20127, yes }, { "ascii", 20127, aye },
{ "cp367", 20127, yes }, { "cp367", 20127, aye },
{ "csascii", 20127, yes }, { "csascii", 20127, aye },
{ "ibm367", 20127, yes }, { "ibm367", 20127, aye },
{ "iso-ir-6", 20127, yes }, { "iso-ir-6", 20127, aye },
{ "iso646-us", 20127, yes }, { "iso646-us", 20127, aye },
{ "iso_646.irv:1991", 20127, yes }, { "iso_646.irv:1991", 20127, aye },
{ "us", 20127, yes }, { "us", 20127, aye },
{ "us-ascii", 20127, yes }, { "us-ascii", 20127, aye },
{ "x-cp20261", 20261, yes }, { "x-cp20261", 20261, aye },
{ "x-cp20269", 20269, yes }, { "x-cp20269", 20269, aye },
{ "cp273", 20273, yes }, { "cp273", 20273, aye },
{ "csibm273", 20273, yes }, { "csibm273", 20273, aye },
{ "ibm273", 20273, yes }, { "ibm273", 20273, aye },
{ "csibm277", 20277, yes }, { "csibm277", 20277, aye },
{ "ebcdic-cp-dk", 20277, yes }, { "ebcdic-cp-dk", 20277, aye },
{ "ebcdic-cp-no", 20277, yes }, { "ebcdic-cp-no", 20277, aye },
{ "ibm277", 20277, yes }, { "ibm277", 20277, aye },
{ "cp278", 20278, yes }, { "cp278", 20278, aye },
{ "csibm278", 20278, yes }, { "csibm278", 20278, aye },
{ "ebcdic-cp-fi", 20278, yes }, { "ebcdic-cp-fi", 20278, aye },
{ "ebcdic-cp-se", 20278, yes }, { "ebcdic-cp-se", 20278, aye },
{ "ibm278", 20278, yes }, { "ibm278", 20278, aye },
{ "cp280", 20280, yes }, { "cp280", 20280, aye },
{ "csibm280", 20280, yes }, { "csibm280", 20280, aye },
{ "ebcdic-cp-it", 20280, yes }, { "ebcdic-cp-it", 20280, aye },
{ "ibm280", 20280, yes }, { "ibm280", 20280, aye },
{ "cp284", 20284, yes }, { "cp284", 20284, aye },
{ "csibm284", 20284, yes }, { "csibm284", 20284, aye },
{ "ebcdic-cp-es", 20284, yes }, { "ebcdic-cp-es", 20284, aye },
{ "ibm284", 20284, yes }, { "ibm284", 20284, aye },
{ "cp285", 20285, yes }, { "cp285", 20285, aye },
{ "csibm285", 20285, yes }, { "csibm285", 20285, aye },
{ "ebcdic-cp-gb", 20285, yes }, { "ebcdic-cp-gb", 20285, aye },
{ "ibm285", 20285, yes }, { "ibm285", 20285, aye },
{ "cp290", 20290, yes }, { "cp290", 20290, aye },
{ "csibm290", 20290, yes }, { "csibm290", 20290, aye },
{ "ebcdic-jp-kana", 20290, yes }, { "ebcdic-jp-kana", 20290, aye },
{ "ibm290", 20290, yes }, { "ibm290", 20290, aye },
{ "cp297", 20297, yes }, { "cp297", 20297, aye },
{ "csibm297", 20297, yes }, { "csibm297", 20297, aye },
{ "ebcdic-cp-fr", 20297, yes }, { "ebcdic-cp-fr", 20297, aye },
{ "ibm297", 20297, yes }, { "ibm297", 20297, aye },
{ "cp420", 20420, yes }, { "cp420", 20420, aye },
{ "csibm420", 20420, yes }, { "csibm420", 20420, aye },
{ "ebcdic-cp-ar1", 20420, yes }, { "ebcdic-cp-ar1", 20420, aye },
{ "ibm420", 20420, yes }, { "ibm420", 20420, aye },
{ "cp423", 20423, yes }, { "cp423", 20423, aye },
{ "csibm423", 20423, yes }, { "csibm423", 20423, aye },
{ "ebcdic-cp-gr", 20423, yes }, { "ebcdic-cp-gr", 20423, aye },
{ "ibm423", 20423, yes }, { "ibm423", 20423, aye },
{ "cp424", 20424, yes }, { "cp424", 20424, aye },
{ "csibm424", 20424, yes }, { "csibm424", 20424, aye },
{ "ebcdic-cp-he", 20424, yes }, { "ebcdic-cp-he", 20424, aye },
{ "ibm424", 20424, yes }, { "ibm424", 20424, aye },
{ "x-ebcdic-koreanextended", 20833, yes }, { "x-ebcdic-koreanextended", 20833, aye },
{ "csibmthai", 20838, yes }, { "csibmthai", 20838, aye },
{ "ibm-thai", 20838, yes }, { "ibm-thai", 20838, aye },
{ "cskoi8r", 20866, yes }, { "cskoi8r", 20866, aye },
{ "koi", 20866, yes }, { "koi", 20866, aye },
{ "koi8", 20866, yes }, { "koi8", 20866, aye },
{ "koi8-r", 20866, yes }, { "koi8-r", 20866, aye },
{ "koi8r", 20866, yes }, { "koi8r", 20866, aye },
{ "cp871", 20871, yes }, { "cp871", 20871, aye },
{ "csibm871", 20871, yes }, { "csibm871", 20871, aye },
{ "ebcdic-cp-is", 20871, yes }, { "ebcdic-cp-is", 20871, aye },
{ "ibm871", 20871, yes }, { "ibm871", 20871, aye },
{ "cp880", 20880, yes }, { "cp880", 20880, aye },
{ "csibm880", 20880, yes }, { "csibm880", 20880, aye },
{ "ebcdic-cyrillic", 20880, yes }, { "ebcdic-cyrillic", 20880, aye },
{ "ibm880", 20880, yes }, { "ibm880", 20880, aye },
{ "cp905", 20905, yes }, { "cp905", 20905, aye },
{ "csibm905", 20905, yes }, { "csibm905", 20905, aye },
{ "ebcdic-cp-tr", 20905, yes }, { "ebcdic-cp-tr", 20905, aye },
{ "ibm905", 20905, yes }, { "ibm905", 20905, aye },
{ "ccsid00924", 20924, yes }, { "ccsid00924", 20924, aye },
{ "cp00924", 20924, yes }, { "cp00924", 20924, aye },
{ "ebcdic-latin9--euro", 20924, yes }, { "ebcdic-latin9--euro", 20924, aye },
{ "ibm00924", 20924, yes }, { "ibm00924", 20924, aye },
{ "x-cp20936", 20936, yes }, { "x-cp20936", 20936, aye },
{ "x-cp20949", 20949, yes }, { "x-cp20949", 20949, aye },
{ "cp1025", 21025, yes }, { "cp1025", 21025, aye },
{ "x-cp21027", 21027, yes }, { "x-cp21027", 21027, aye },
{ "koi8-ru", 21866, yes }, { "koi8-ru", 21866, aye },
{ "koi8-u", 21866, yes }, { "koi8-u", 21866, aye },
{ "cp819", 28591, yes }, { "cp819", 28591, aye },
{ "csisolatin1", 28591, yes }, { "csisolatin1", 28591, aye },
{ "ibm819", 28591, yes }, { "ibm819", 28591, aye },
{ "iso-8859-1", 28591, yes }, { "iso-8859-1", 28591, aye },
{ "iso-ir-100", 28591, yes }, { "iso-ir-100", 28591, aye },
{ "iso8859-1", 28591, yes }, { "iso8859-1", 28591, aye },
{ "iso_8859-1", 28591, yes }, { "iso_8859-1", 28591, aye },
{ "iso_8859-1:1987", 28591, yes }, { "iso_8859-1:1987", 28591, aye },
{ "l1", 28591, yes }, { "l1", 28591, aye },
{ "latin1", 28591, yes }, { "latin1", 28591, aye },
{ "csisolatin2", 28592, yes }, { "csisolatin2", 28592, aye },
{ "iso-8859-2", 28592, yes }, { "iso-8859-2", 28592, aye },
{ "iso-ir-101", 28592, yes }, { "iso-ir-101", 28592, aye },
{ "iso8859-2", 28592, yes }, { "iso8859-2", 28592, aye },
{ "iso_8859-2", 28592, yes }, { "iso_8859-2", 28592, aye },
{ "iso_8859-2:1987", 28592, yes }, { "iso_8859-2:1987", 28592, aye },
{ "l2", 28592, yes }, { "l2", 28592, aye },
{ "latin2", 28592, yes }, { "latin2", 28592, aye },
{ "csisolatin3", 28593, yes }, { "csisolatin3", 28593, aye },
{ "iso-8859-3", 28593, yes }, { "iso-8859-3", 28593, aye },
{ "iso-ir-109", 28593, yes }, { "iso-ir-109", 28593, aye },
{ "iso_8859-3", 28593, yes }, { "iso_8859-3", 28593, aye },
{ "iso_8859-3:1988", 28593, yes }, { "iso_8859-3:1988", 28593, aye },
{ "l3", 28593, yes }, { "l3", 28593, aye },
{ "latin3", 28593, yes }, { "latin3", 28593, aye },
{ "csisolatin4", 28594, yes }, { "csisolatin4", 28594, aye },
{ "iso-8859-4", 28594, yes }, { "iso-8859-4", 28594, aye },
{ "iso-ir-110", 28594, yes }, { "iso-ir-110", 28594, aye },
{ "iso_8859-4", 28594, yes }, { "iso_8859-4", 28594, aye },
{ "iso_8859-4:1988", 28594, yes }, { "iso_8859-4:1988", 28594, aye },
{ "l4", 28594, yes }, { "l4", 28594, aye },
{ "latin4", 28594, yes }, { "latin4", 28594, aye },
{ "csisolatincyrillic", 28595, yes }, { "csisolatincyrillic", 28595, aye },
{ "cyrillic", 28595, yes }, { "cyrillic", 28595, aye },
{ "iso-8859-5", 28595, yes }, { "iso-8859-5", 28595, aye },
{ "iso-ir-144", 28595, yes }, { "iso-ir-144", 28595, aye },
{ "iso_8859-5", 28595, yes }, { "iso_8859-5", 28595, aye },
{ "iso_8859-5:1988", 28595, yes }, { "iso_8859-5:1988", 28595, aye },
{ "arabic", 28596, yes }, { "arabic", 28596, aye },
{ "csisolatinarabic", 28596, yes }, { "csisolatinarabic", 28596, aye },
{ "ecma-114", 28596, yes }, { "ecma-114", 28596, aye },
{ "iso-8859-6", 28596, yes }, { "iso-8859-6", 28596, aye },
{ "iso-ir-127", 28596, yes }, { "iso-ir-127", 28596, aye },
{ "iso_8859-6", 28596, yes }, { "iso_8859-6", 28596, aye },
{ "iso_8859-6:1987", 28596, yes }, { "iso_8859-6:1987", 28596, aye },
{ "csisolatingreek", 28597, yes }, { "csisolatingreek", 28597, aye },
{ "ecma-118", 28597, yes }, { "ecma-118", 28597, aye },
{ "elot_928", 28597, yes }, { "elot_928", 28597, aye },
{ "greek", 28597, yes }, { "greek", 28597, aye },
{ "greek8", 28597, yes }, { "greek8", 28597, aye },
{ "iso-8859-7", 28597, yes }, { "iso-8859-7", 28597, aye },
{ "iso-ir-126", 28597, yes }, { "iso-ir-126", 28597, aye },
{ "iso_8859-7", 28597, yes }, { "iso_8859-7", 28597, aye },
{ "iso_8859-7:1987", 28597, yes }, { "iso_8859-7:1987", 28597, aye },
{ "csisolatinhebrew", 28598, yes }, { "csisolatinhebrew", 28598, aye },
{ "hebrew", 28598, yes }, { "hebrew", 28598, aye },
{ "iso-8859-8", 28598, yes }, { "iso-8859-8", 28598, aye },
{ "iso-ir-138", 28598, yes }, { "iso-ir-138", 28598, aye },
{ "iso_8859-8", 28598, yes }, { "iso_8859-8", 28598, aye },
{ "iso_8859-8:1988", 28598, yes }, { "iso_8859-8:1988", 28598, aye },
{ "logical", 28598, yes }, { "logical", 28598, aye },
{ "visual", 28598, yes }, { "visual", 28598, aye },
{ "csisolatin5", 28599, yes }, { "csisolatin5", 28599, aye },
{ "iso-8859-9", 28599, yes }, { "iso-8859-9", 28599, aye },
{ "iso-ir-148", 28599, yes }, { "iso-ir-148", 28599, aye },
{ "iso_8859-9", 28599, yes }, { "iso_8859-9", 28599, aye },
{ "iso_8859-9:1989", 28599, yes }, { "iso_8859-9:1989", 28599, aye },
{ "l5", 28599, yes }, { "l5", 28599, aye },
{ "latin5", 28599, yes }, { "latin5", 28599, aye },
{ "iso-8859-13", 28603, yes }, { "iso-8859-13", 28603, aye },
{ "csisolatin9", 28605, yes }, { "csisolatin9", 28605, aye },
{ "iso-8859-15", 28605, yes }, { "iso-8859-15", 28605, aye },
{ "iso_8859-15", 28605, yes }, { "iso_8859-15", 28605, aye },
{ "l9", 28605, yes }, { "l9", 28605, aye },
{ "latin9", 28605, yes }, { "latin9", 28605, aye },
{ "x-europa", 29001, yes }, { "x-europa", 29001, aye },
{ "iso-8859-8-i", 38598, yes }, { "iso-8859-8-i", 38598, aye },
{ "iso-2022-jp", 50220, no }, { "iso-2022-jp", 50220, no },
{ "csiso2022jp", 50221, no }, { "csiso2022jp", 50221, no },
{ "csiso2022kr", 50225, no }, { "csiso2022kr", 50225, no },
@ -425,47 +425,47 @@ static struct _nameWinCPMap
{ "iso-2022-kr-7bit", 50225, no }, { "iso-2022-kr-7bit", 50225, no },
{ "cp50227", 50227, no }, { "cp50227", 50227, no },
{ "x-cp50227", 50227, no }, { "x-cp50227", 50227, no },
{ "cp930", 50930, yes }, { "cp930", 50930, aye },
{ "x-ebcdic-japaneseanduscanada", 50931, yes }, { "x-ebcdic-japaneseanduscanada", 50931, aye },
{ "cp933", 50933, yes }, { "cp933", 50933, aye },
{ "cp935", 50935, yes }, { "cp935", 50935, aye },
{ "cp937", 50937, yes }, { "cp937", 50937, aye },
{ "cp939", 50939, yes }, { "cp939", 50939, aye },
{ "cseucpkdfmtjapanese", 51932, yes }, { "cseucpkdfmtjapanese", 51932, aye },
{ "euc-jp", 51932, yes }, { "euc-jp", 51932, aye },
{ "extended_unix_code_packed_format_for_japanese", 51932, yes }, { "extended_unix_code_packed_format_for_japanese", 51932, aye },
{ "iso-2022-jpeuc", 51932, yes }, { "iso-2022-jpeuc", 51932, aye },
{ "x-euc", 51932, yes }, { "x-euc", 51932, aye },
{ "x-euc-jp", 51932, yes }, { "x-euc-jp", 51932, aye },
{ "euc-cn", 51936, yes }, { "euc-cn", 51936, aye },
{ "x-euc-cn", 51936, yes }, { "x-euc-cn", 51936, aye },
{ "cseuckr", 51949, yes }, { "cseuckr", 51949, aye },
{ "euc-kr", 51949, yes }, { "euc-kr", 51949, aye },
{ "iso-2022-kr-8", 51949, yes }, { "iso-2022-kr-8", 51949, aye },
{ "iso-2022-kr-8bit", 51949, yes }, { "iso-2022-kr-8bit", 51949, aye },
{ "hz-gb-2312", 52936, no }, { "hz-gb-2312", 52936, no },
{ "gb18030", 54936, yes }, { "gb18030", 54936, aye },
{ "x-iscii-de", 57002, yes }, { "x-iscii-de", 57002, aye },
{ "x-iscii-be", 57003, yes }, { "x-iscii-be", 57003, aye },
{ "x-iscii-ta", 57004, yes }, { "x-iscii-ta", 57004, aye },
{ "x-iscii-te", 57005, yes }, { "x-iscii-te", 57005, aye },
{ "x-iscii-as", 57006, yes }, { "x-iscii-as", 57006, aye },
{ "x-iscii-or", 57007, yes }, { "x-iscii-or", 57007, aye },
{ "x-iscii-ka", 57008, yes }, { "x-iscii-ka", 57008, aye },
{ "x-iscii-ma", 57009, yes }, { "x-iscii-ma", 57009, aye },
{ "x-iscii-gu", 57010, yes }, { "x-iscii-gu", 57010, aye },
{ "x-iscii-pa", 57011, yes }, { "x-iscii-pa", 57011, aye },
{ "csunicode11utf7", 65000, no }, { "csunicode11utf7", 65000, no },
{ "unicode-1-1-utf-7", 65000, no }, { "unicode-1-1-utf-7", 65000, no },
{ "unicode-2-0-utf-7", 65000, no }, { "unicode-2-0-utf-7", 65000, no },
{ "utf-7", 65000, no }, { "utf-7", 65000, no },
{ "x-unicode-1-1-utf-7", 65000, no }, { "x-unicode-1-1-utf-7", 65000, no },
{ "x-unicode-2-0-utf-7", 65000, no }, { "x-unicode-2-0-utf-7", 65000, no },
{ "unicode-1-1-utf-8", 65001, yes }, { "unicode-1-1-utf-8", 65001, aye },
{ "unicode-2-0-utf-8", 65001, yes }, { "unicode-2-0-utf-8", 65001, aye },
{ "utf-8", 65001, yes }, { "utf-8", 65001, aye },
{ "x-unicode-1-1-utf-8", 65001, yes }, { "x-unicode-1-1-utf-8", 65001, aye },
{ "x-unicode-2-0-utf-8", 65001, yes }, { "x-unicode-2-0-utf-8", 65001, aye },
/* final entry */ /* final entry */
{ NULL, 0, no } { NULL, 0, no }
@ -556,7 +556,7 @@ Bool TY_(Win32MLangInitInputTranscoder)(StreamIn * in, uint wincp)
in->mlang = p; in->mlang = p;
return yes; return aye;
} }
void TY_(Win32MLangUninitInputTranscoder)(StreamIn * in) void TY_(Win32MLangUninitInputTranscoder)(StreamIn * in)
@ -612,7 +612,7 @@ Bool Win32MLangInitOutputTranscoder(TidyAllocator *allocator, StreamOut * out, t
out->mlang = p; out->mlang = p;
return yes; return aye;
} }
void Win32MLangUninitOutputTranscoder(StreamOut * out) void Win32MLangUninitOutputTranscoder(StreamOut * out)
@ -731,7 +731,7 @@ Bool Win32MLangIsConvertible(tchar c, StreamOut * out)
p = (IMLangConvertCharset *)out->mlang; p = (IMLangConvertCharset *)out->mlang;
hr = IMLangConvertCharset_DoConversionFromUnicode(p, inbuf, &inbufsize, NULL, NULL); hr = IMLangConvertCharset_DoConversionFromUnicode(p, inbuf, &inbufsize, NULL, NULL);
return hr == S_OK ? yes : no; return hr == S_OK ? aye : no;
} }
void Win32MLangPutChar(tchar c, StreamOut * out, uint * bytesWritten) void Win32MLangPutChar(tchar c, StreamOut * out, uint * bytesWritten)
@ -769,7 +769,7 @@ void Win32MLangPutChar(tchar c, StreamOut * out, uint * bytesWritten)
inbuf[inbufsize++] = (WCHAR)c; inbuf[inbufsize++] = (WCHAR)c;
hr = IMLangConvertCharset_DoConversionFromUnicode(p, inbuf, &inbufsize, outbuf, &outbufsize); hr = IMLangConvertCharset_DoConversionFromUnicode(p, inbuf, &inbufsize, outbuf, &outbufsize);
assert( hr == S_OK ); assert( hr == S_OK );
assert( outbufsize > 0 ); assert( outbufsize > 0 );
assert( inbufsize == 1 || inbufsize == 2 ); assert( inbufsize == 1 || inbufsize == 2 );

Loading…
Cancel
Save