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. 186
      src/access.c
  16. 8
      src/alloc.cpp
  17. 38
      src/attrs.c
  18. 28
      src/charsets.c
  19. 68
      src/clean.c
  20. 98
      src/config.c
  21. 4
      src/entities.c
  22. 56
      src/htmltidy.cpp
  23. 22
      src/init.c
  24. 16
      src/istack.c
  25. 100
      src/lexer.c
  26. 2
      src/mappedio.c
  27. 168
      src/parser.c
  28. 68
      src/pprint.c
  29. 12
      src/streamio.c
  30. 16
      src/tags.c
  31. 4
      src/tidy.h
  32. 12
      src/tidyenum.h
  33. 66
      src/tidylib.c
  34. 2
      src/tidyplatform.h
  35. 34
      src/utf8.c
  36. 790
      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);
}

186
src/access.c

@ -179,7 +179,7 @@ static void GetFileExtension( ctmbstr path, tmbchar *ext, uint maxExt )
* IsImage * IsImage
* *
* Checks if the given filename is an image file. * Checks if the given filename is an image file.
* Returns 'yes' if it is, 'no' if it's not. * Returns 'aye' if it is, 'no' if it's not.
************************************************************************/ ************************************************************************/
static Bool IsImage( ctmbstr iType ) static Bool IsImage( ctmbstr iType )
@ -194,7 +194,7 @@ static Bool IsImage( ctmbstr iType )
for (i = 0; i < N_IMAGE_EXTS; i++) for (i = 0; i < N_IMAGE_EXTS; i++)
{ {
if ( TY_(tmbstrcasecmp)(ext, imageExtensions[i]) == 0 ) if ( TY_(tmbstrcasecmp)(ext, imageExtensions[i]) == 0 )
return yes; return aye;
} }
return no; return no;
@ -205,7 +205,7 @@ static Bool IsImage( ctmbstr iType )
* IsSoundFile * IsSoundFile
* *
* Checks if the given filename is a sound file. * Checks if the given filename is a sound file.
* Returns 'yes' if it is, 'no' if it's not. * Returns 'aye' if it is, 'no' if it's not.
***********************************************************************/ ***********************************************************************/
static int IsSoundFile( ctmbstr sType ) static int IsSoundFile( ctmbstr sType )
@ -230,7 +230,7 @@ static int IsSoundFile( ctmbstr sType )
* The 'SRC' extension must end in ".htm", ".html", ".shtm", ".shtml", * The 'SRC' extension must end in ".htm", ".html", ".shtm", ".shtml",
* ".cfm", ".cfml", ".asp", ".cgi", ".pl", or ".smil" * ".cfm", ".cfml", ".asp", ".cgi", ".pl", or ".smil"
* *
* Returns yes if it is, returns no otherwise. * Returns aye if it is, returns no otherwise.
***********************************************************************/ ***********************************************************************/
static Bool IsValidSrcExtension( ctmbstr sType ) static Bool IsValidSrcExtension( ctmbstr sType )
@ -242,7 +242,7 @@ static Bool IsValidSrcExtension( ctmbstr sType )
for (i = 0; i < N_FRAME_EXTS; i++) for (i = 0; i < N_FRAME_EXTS; i++)
{ {
if ( TY_(tmbstrcasecmp)(ext, frameExtensions[i]) == 0 ) if ( TY_(tmbstrcasecmp)(ext, frameExtensions[i]) == 0 )
return yes; return aye;
} }
return no; return no;
} }
@ -264,7 +264,7 @@ static Bool IsValidMediaExtension( ctmbstr sType )
for (i = 0; i < N_MEDIA_EXTS; i++) for (i = 0; i < N_MEDIA_EXTS; i++)
{ {
if ( TY_(tmbstrcasecmp)(ext, mediaExtensions[i]) == 0 ) if ( TY_(tmbstrcasecmp)(ext, mediaExtensions[i]) == 0 )
return yes; return aye;
} }
return no; return no;
} }
@ -274,12 +274,12 @@ static Bool IsValidMediaExtension( ctmbstr sType )
* IsWhitespace * IsWhitespace
* *
* Checks if the given string is all whitespace. * Checks if the given string is all whitespace.
* Returns 'yes' if it is, 'no' if it's not. * Returns 'aye' if it is, 'no' if it's not.
************************************************************************/ ************************************************************************/
static Bool IsWhitespace( ctmbstr pString ) static Bool IsWhitespace( ctmbstr pString )
{ {
Bool isWht = yes; Bool isWht = aye;
ctmbstr cp; ctmbstr cp;
for ( cp = pString; isWht && cp && *cp; ++cp ) for ( cp = pString; isWht && cp && *cp; ++cp )
@ -300,7 +300,7 @@ static Bool hasValue( AttVal* av )
* Checks to see if there is an image and photo place holder contained * Checks to see if there is an image and photo place holder contained
* in the ALT text. * in the ALT text.
* *
* Returns 'yes' if there is, 'no' if not. * Returns 'aye' if there is, 'no' if not.
***********************************************************************/ ***********************************************************************/
static Bool IsPlaceholderAlt( ctmbstr txt ) static Bool IsPlaceholderAlt( ctmbstr txt )
@ -316,7 +316,7 @@ static Bool IsPlaceholderAlt( ctmbstr txt )
* Checks to see if there is an TITLE place holder contained * Checks to see if there is an TITLE place holder contained
* in the 'ALT' text. * in the 'ALT' text.
* *
* Returns 'yes' if there is, 'no' if not. * Returns 'aye' if there is, 'no' if not.
static Bool IsPlaceHolderTitle( ctmbstr txt ) static Bool IsPlaceHolderTitle( ctmbstr txt )
{ {
@ -331,7 +331,7 @@ static Bool IsPlaceHolderTitle( ctmbstr txt )
* Checks to see if there is an OBJECT place holder contained * Checks to see if there is an OBJECT place holder contained
* in the 'ALT' text. * in the 'ALT' text.
* *
* Returns 'yes' if there is, 'no' if not. * Returns 'aye' if there is, 'no' if not.
***********************************************************************/ ***********************************************************************/
static Bool IsPlaceHolderObject( ctmbstr txt ) static Bool IsPlaceHolderObject( ctmbstr txt )
@ -344,7 +344,7 @@ static Bool IsPlaceHolderObject( ctmbstr txt )
* EndsWithBytes * EndsWithBytes
* *
* Checks to see if the ALT text ends with 'bytes' * Checks to see if the ALT text ends with 'bytes'
* Returns 'yes', if true, 'no' otherwise. * Returns 'aye', if true, 'no' otherwise.
**********************************************************/ **********************************************************/
static Bool EndsWithBytes( ctmbstr txt ) static Bool EndsWithBytes( ctmbstr txt )
@ -513,7 +513,7 @@ static void CheckColorContrast( TidyDocImpl* doc, Node* node )
if (Level3_Enabled( doc )) if (Level3_Enabled( doc ))
{ {
Bool gotBG = yes; Bool gotBG = aye;
AttVal* av; AttVal* av;
/* Check for 'BGCOLOR' first to compare with other color attributes */ /* Check for 'BGCOLOR' first to compare with other color attributes */
@ -609,7 +609,7 @@ static Bool GetRgb( ctmbstr color, int rgb[] )
rgb[0] = colorValues[x][0]; rgb[0] = colorValues[x][0];
rgb[1] = colorValues[x][1]; rgb[1] = colorValues[x][1];
rgb[2] = colorValues[x][2]; rgb[2] = colorValues[x][2];
return yes; return aye;
} }
} }
@ -624,7 +624,7 @@ static Bool GetRgb( ctmbstr color, int rgb[] )
rgb[0] = (ctox(color[1]) * 16) + ctox(color[2]); rgb[0] = (ctox(color[1]) * 16) + ctox(color[2]);
rgb[1] = (ctox(color[3]) * 16) + ctox(color[4]); rgb[1] = (ctox(color[3]) * 16) + ctox(color[4]);
rgb[2] = (ctox(color[5]) * 16) + ctox(color[6]); rgb[2] = (ctox(color[5]) * 16) + ctox(color[6]);
return yes; return aye;
} }
return no; return no;
} }
@ -701,30 +701,30 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
(EndsWithBytes (av->value) == no) && (EndsWithBytes (av->value) == no) &&
(IsImage (av->value) == no)) (IsImage (av->value) == no))
{ {
HasAlt = yes; HasAlt = aye;
} }
else if (TY_(tmbstrlen)(av->value) > 150) else if (TY_(tmbstrlen)(av->value) > 150)
{ {
HasAlt = yes; HasAlt = aye;
TY_(ReportAccessWarning)( doc, node, IMG_ALT_SUSPICIOUS_TOO_LONG ); TY_(ReportAccessWarning)( doc, node, IMG_ALT_SUSPICIOUS_TOO_LONG );
} }
else if (IsImage (av->value) == yes) else if (IsImage (av->value) == aye)
{ {
HasAlt = yes; HasAlt = aye;
TY_(ReportAccessWarning)( doc, node, IMG_ALT_SUSPICIOUS_FILENAME); TY_(ReportAccessWarning)( doc, node, IMG_ALT_SUSPICIOUS_FILENAME);
} }
else if (IsPlaceholderAlt (av->value) == yes) else if (IsPlaceholderAlt (av->value) == aye)
{ {
HasAlt = yes; HasAlt = aye;
TY_(ReportAccessWarning)( doc, node, IMG_ALT_SUSPICIOUS_PLACEHOLDER); TY_(ReportAccessWarning)( doc, node, IMG_ALT_SUSPICIOUS_PLACEHOLDER);
} }
else if (EndsWithBytes (av->value) == yes) else if (EndsWithBytes (av->value) == aye)
{ {
HasAlt = yes; HasAlt = aye;
TY_(ReportAccessWarning)( doc, node, IMG_ALT_SUSPICIOUS_FILE_SIZE); TY_(ReportAccessWarning)( doc, node, IMG_ALT_SUSPICIOUS_FILE_SIZE);
} }
} }
@ -744,10 +744,10 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
{ {
int width = atoi( av->value ); int width = atoi( av->value );
if ( width < 30 ) if ( width < 30 )
HasValidWidthBullet = yes; HasValidWidthBullet = aye;
if ( width > 150 ) if ( width > 150 )
HasValidWidthHR = yes; HasValidWidthHR = aye;
} }
} }
@ -762,7 +762,7 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
{ {
/* Longdesc attribute needed if height attribute not present. */ /* Longdesc attribute needed if height attribute not present. */
if ( hasValue(av) && atoi(av->value) < 30 ) if ( hasValue(av) && atoi(av->value) < 30 )
HasValidHeight = yes; HasValidHeight = aye;
} }
/* /*
@ -772,7 +772,7 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
else if ( attrIsLONGDESC(av) ) else if ( attrIsLONGDESC(av) )
{ {
if ( hasValue(av) && TY_(tmbstrlen)(av->value) > 1 ) if ( hasValue(av) && TY_(tmbstrlen)(av->value) > 1 )
HasLongDesc = yes; HasLongDesc = aye;
} }
/* /*
@ -782,12 +782,12 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
else if ( attrIsUSEMAP(av) ) else if ( attrIsUSEMAP(av) )
{ {
if ( hasValue(av) ) if ( hasValue(av) )
doc->access.HasUseMap = yes; doc->access.HasUseMap = aye;
} }
else if ( attrIsISMAP(av) ) else if ( attrIsISMAP(av) )
{ {
HasIsMap = yes; HasIsMap = aye;
} }
} }
@ -815,7 +815,7 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
if ((TY_(tmbstrcmp)(word,"d") == 0)|| if ((TY_(tmbstrcmp)(word,"d") == 0)||
(TY_(tmbstrcmp)(word,"D") == 0)) (TY_(tmbstrcmp)(word,"D") == 0))
{ {
HasDLINK = yes; HasDLINK = aye;
} }
} }
} }
@ -846,21 +846,21 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
if ((TY_(tmbstrcmp)(word, "d") == 0)|| if ((TY_(tmbstrcmp)(word, "d") == 0)||
(TY_(tmbstrcmp)(word, "D") == 0)) (TY_(tmbstrcmp)(word, "D") == 0))
{ {
HasDLINK = yes; HasDLINK = aye;
} }
} }
} }
} }
if ((HasAlt == no)&& if ((HasAlt == no)&&
(HasValidWidthBullet == yes)&& (HasValidWidthBullet == aye)&&
(HasValidHeight == yes)) (HasValidHeight == aye))
{ {
} }
if ((HasAlt == no)&& if ((HasAlt == no)&&
(HasValidWidthHR == yes)&& (HasValidWidthHR == aye)&&
(HasValidHeight == yes)) (HasValidHeight == aye))
{ {
} }
@ -870,22 +870,22 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
} }
if ((HasLongDesc == no)&& if ((HasLongDesc == no)&&
(HasValidHeight ==yes)&& (HasValidHeight ==aye)&&
((HasValidWidthHR == yes)|| ((HasValidWidthHR == aye)||
(HasValidWidthBullet == yes))) (HasValidWidthBullet == aye)))
{ {
HasTriggeredMissingLongDesc = yes; HasTriggeredMissingLongDesc = aye;
} }
if (HasTriggeredMissingLongDesc == no) if (HasTriggeredMissingLongDesc == no)
{ {
if ((HasDLINK == yes)&& if ((HasDLINK == aye)&&
(HasLongDesc == no)) (HasLongDesc == no))
{ {
TY_(ReportAccessWarning)( doc, node, IMG_MISSING_LONGDESC); TY_(ReportAccessWarning)( doc, node, IMG_MISSING_LONGDESC);
} }
if ((HasLongDesc == yes)&& if ((HasLongDesc == aye)&&
(HasDLINK == no)) (HasDLINK == no))
{ {
TY_(ReportAccessWarning)( doc, node, IMG_MISSING_DLINK); TY_(ReportAccessWarning)( doc, node, IMG_MISSING_DLINK);
@ -898,7 +898,7 @@ static void CheckImage( TidyDocImpl* doc, Node* node )
} }
} }
if (HasIsMap == yes) if (HasIsMap == aye)
{ {
TY_(ReportAccessError)( doc, node, IMAGE_MAP_SERVER_SIDE_REQUIRES_CONVERSION); TY_(ReportAccessError)( doc, node, IMAGE_MAP_SERVER_SIDE_REQUIRES_CONVERSION);
@ -941,7 +941,7 @@ static void CheckApplet( TidyDocImpl* doc, Node* node )
{ {
if (av->value != NULL) if (av->value != NULL)
{ {
HasAlt = yes; HasAlt = aye;
} }
} }
} }
@ -963,7 +963,7 @@ static void CheckApplet( TidyDocImpl* doc, Node* node )
} }
if ( word != NULL && !IsWhitespace(word) ) if ( word != NULL && !IsWhitespace(word) )
HasDescription = yes; HasDescription = aye;
} }
} }
@ -1002,7 +1002,7 @@ static void CheckObject( TidyDocImpl* doc, Node* node )
{ {
if ( attrIsALT(av) ) if ( attrIsALT(av) )
{ {
HasAlt = yes; HasAlt = aye;
break; break;
} }
} }
@ -1023,7 +1023,7 @@ static void CheckObject( TidyDocImpl* doc, Node* node )
} }
if ( word != NULL && !IsWhitespace(word) ) if ( word != NULL && !IsWhitespace(word) )
HasDescription = yes; HasDescription = aye;
} }
} }
@ -1120,20 +1120,20 @@ static void CheckFrame( TidyDocImpl* doc, Node* node )
else if ( attrIsTITLE(av) ) else if ( attrIsTITLE(av) )
{ {
if ( hasValue(av) ) if ( hasValue(av) )
HasTitle = yes; HasTitle = aye;
if ( !HasTitle ) if ( !HasTitle )
{ {
if ( av->value == NULL || TY_(tmbstrlen)(av->value) == 0 ) if ( av->value == NULL || TY_(tmbstrlen)(av->value) == 0 )
{ {
HasTitle = yes; HasTitle = aye;
TY_(ReportAccessError)( doc, node, FRAME_TITLE_INVALID_NULL); TY_(ReportAccessError)( doc, node, FRAME_TITLE_INVALID_NULL);
} }
else else
{ {
if ( IsWhitespace(av->value) && TY_(tmbstrlen)(av->value) > 0 ) if ( IsWhitespace(av->value) && TY_(tmbstrlen)(av->value) > 0 )
{ {
HasTitle = yes; HasTitle = aye;
TY_(ReportAccessError)( doc, node, FRAME_TITLE_INVALID_SPACES ); TY_(ReportAccessError)( doc, node, FRAME_TITLE_INVALID_SPACES );
} }
} }
@ -1230,7 +1230,7 @@ static void CheckAnchorAccess( TidyDocImpl* doc, Node* node )
/* Must contain at least one letter in the text */ /* Must contain at least one letter in the text */
if (IsWhitespace (word) == no) if (IsWhitespace (word) == no)
{ {
HasDescription = yes; HasDescription = aye;
} }
} }
} }
@ -1275,7 +1275,7 @@ static void CheckAnchorAccess( TidyDocImpl* doc, Node* node )
{ {
if (TY_(tmbstrcmp) (word, "more") == 0) if (TY_(tmbstrcmp) (word, "more") == 0)
{ {
HasTriggeredLink = yes; HasTriggeredLink = aye;
} }
if (TY_(tmbstrcmp) (word, "click here") == 0) if (TY_(tmbstrcmp) (word, "click here") == 0)
@ -1338,7 +1338,7 @@ static void CheckArea( TidyDocImpl* doc, Node* node )
/* The check for validity */ /* The check for validity */
if (av->value != NULL) if (av->value != NULL)
{ {
HasAlt = yes; HasAlt = aye;
} }
} }
} }
@ -1409,7 +1409,7 @@ static void CheckRows( TidyDocImpl* doc, Node* node )
numTR++; numTR++;
if ( nodeIsTH(node->content) ) if ( nodeIsTH(node->content) )
{ {
doc->access.HasTH = yes; doc->access.HasTH = aye;
if ( TY_(nodeIsText)(node->content->content) ) if ( TY_(nodeIsText)(node->content->content) )
{ {
ctmbstr word = textFromOneNode( doc, node->content->content); ctmbstr word = textFromOneNode( doc, node->content->content);
@ -1420,13 +1420,13 @@ static void CheckRows( TidyDocImpl* doc, Node* node )
} }
if (numTR == numValidTH) if (numTR == numValidTH)
doc->access.HasValidRowHeaders = yes; doc->access.HasValidRowHeaders = aye;
if ( numTR >= 2 && if ( numTR >= 2 &&
numTR > numValidTH && numTR > numValidTH &&
numValidTH >= 2 && numValidTH >= 2 &&
doc->access.HasTH == yes ) doc->access.HasTH == aye )
doc->access.HasInvalidRowHeader = yes; doc->access.HasInvalidRowHeader = aye;
} }
@ -1448,7 +1448,7 @@ static void CheckColumns( TidyDocImpl* doc, Node* node )
/* Table must have row of headers if headers for columns don't exist */ /* Table must have row of headers if headers for columns don't exist */
if ( nodeIsTH(node->content) ) if ( nodeIsTH(node->content) )
{ {
doc->access.HasTH = yes; doc->access.HasTH = aye;
for ( tnode = node->content; tnode; tnode = tnode->next ) for ( tnode = node->content; tnode; tnode = tnode->next )
{ {
@ -1463,16 +1463,16 @@ static void CheckColumns( TidyDocImpl* doc, Node* node )
} }
else else
{ {
isMissingHeader = yes; isMissingHeader = aye;
} }
} }
} }
if ( !isMissingHeader && numTH > 0 ) if ( !isMissingHeader && numTH > 0 )
doc->access.HasValidColumnHeaders = yes; doc->access.HasValidColumnHeaders = aye;
if ( isMissingHeader && numTH >= 2 ) if ( isMissingHeader && numTH >= 2 )
doc->access.HasInvalidColumnHeader = yes; doc->access.HasInvalidColumnHeader = aye;
} }
@ -1501,20 +1501,20 @@ static void CheckTH( TidyDocImpl* doc, Node* node )
if ((av->value != NULL)&& if ((av->value != NULL)&&
(IsWhitespace (av->value) == no)) (IsWhitespace (av->value) == no))
{ {
HasAbbr = yes; HasAbbr = aye;
} }
if ((av->value == NULL)|| if ((av->value == NULL)||
(TY_(tmbstrlen)(av->value) == 0)) (TY_(tmbstrlen)(av->value) == 0))
{ {
HasAbbr = yes; HasAbbr = aye;
TY_(ReportAccessWarning)( doc, node, TABLE_MAY_REQUIRE_HEADER_ABBR_NULL); TY_(ReportAccessWarning)( doc, node, TABLE_MAY_REQUIRE_HEADER_ABBR_NULL);
} }
if ((IsWhitespace (av->value) == yes)&& if ((IsWhitespace (av->value) == aye)&&
(TY_(tmbstrlen)(av->value) > 0)) (TY_(tmbstrlen)(av->value) > 0))
{ {
HasAbbr = yes; HasAbbr = aye;
TY_(ReportAccessWarning)( doc, node, TABLE_MAY_REQUIRE_HEADER_ABBR_SPACES); TY_(ReportAccessWarning)( doc, node, TABLE_MAY_REQUIRE_HEADER_ABBR_SPACES);
} }
} }
@ -1551,8 +1551,8 @@ static void CheckMultiHeaders( TidyDocImpl* doc, Node* node )
Node* TNode; Node* TNode;
Node* temp; Node* temp;
Bool validColSpanRows = yes; Bool validColSpanRows = aye;
Bool validColSpanColumns = yes; Bool validColSpanColumns = aye;
int flag = 0; int flag = 0;
@ -1657,7 +1657,7 @@ static void CheckTable( TidyDocImpl* doc, Node* node )
{ {
if ( hasValue(av) ) if ( hasValue(av) )
{ {
HasSummary = yes; HasSummary = aye;
if (AttrContains(av, "summary") && if (AttrContains(av, "summary") &&
AttrContains(av, "table")) AttrContains(av, "table"))
@ -1668,12 +1668,12 @@ static void CheckTable( TidyDocImpl* doc, Node* node )
if ( av->value == NULL || TY_(tmbstrlen)(av->value) == 0 ) if ( av->value == NULL || TY_(tmbstrlen)(av->value) == 0 )
{ {
HasSummary = yes; HasSummary = aye;
TY_(ReportAccessError)( doc, node, TABLE_SUMMARY_INVALID_NULL ); TY_(ReportAccessError)( doc, node, TABLE_SUMMARY_INVALID_NULL );
} }
else if ( IsWhitespace(av->value) && TY_(tmbstrlen)(av->value) > 0 ) else if ( IsWhitespace(av->value) && TY_(tmbstrlen)(av->value) > 0 )
{ {
HasSummary = yes; HasSummary = aye;
TY_(ReportAccessError)( doc, node, TABLE_SUMMARY_INVALID_SPACES ); TY_(ReportAccessError)( doc, node, TABLE_SUMMARY_INVALID_SPACES );
} }
} }
@ -1708,7 +1708,7 @@ static void CheckTable( TidyDocImpl* doc, Node* node )
if ( !IsWhitespace(word) ) if ( !IsWhitespace(word) )
{ {
HasCaption = yes; HasCaption = aye;
} }
} }
@ -1880,11 +1880,11 @@ static void CheckASCII( TidyDocImpl* doc, Node* node )
*/ */
if (newLines >= 6 || matchingCount >= 5) if (newLines >= 6 || matchingCount >= 5)
{ {
IsAscii = yes; IsAscii = aye;
} }
/* Checks for skip over link if ASCII art is present */ /* Checks for skip over link if ASCII art is present */
if (IsAscii == yes) if (IsAscii == aye)
{ {
if (node->prev != NULL && node->prev->prev != NULL) if (node->prev != NULL && node->prev->prev != NULL)
{ {
@ -1934,7 +1934,7 @@ static void CheckASCII( TidyDocImpl* doc, Node* node )
} }
} }
if (IsAscii == yes) if (IsAscii == aye)
{ {
TY_(ReportAccessError)( doc, node, ASCII_REQUIRES_DESCRIPTION); TY_(ReportAccessError)( doc, node, ASCII_REQUIRES_DESCRIPTION);
if (Level3_Enabled( doc ) && (HasSkipOverLink < 2)) if (Level3_Enabled( doc ) && (HasSkipOverLink < 2))
@ -1987,7 +1987,7 @@ static void CheckLabel( TidyDocImpl* doc, Node* node )
/* Checks for valid 'FOR' attribute */ /* Checks for valid 'FOR' attribute */
AttVal* av = attrGetFOR( node ); AttVal* av = attrGetFOR( node );
if ( hasValue(av) ) if ( hasValue(av) )
doc->access.HasValidFor = yes; doc->access.HasValidFor = aye;
if ( ++doc->access.ForID == 2 ) if ( ++doc->access.ForID == 2 )
{ {
@ -2018,7 +2018,7 @@ static void CheckInputLabel( TidyDocImpl* doc, Node* node )
{ {
/* Must have valid 'ID' value */ /* Must have valid 'ID' value */
if ( attrIsID(av) && hasValue(av) ) if ( attrIsID(av) && hasValue(av) )
doc->access.HasValidId = yes; doc->access.HasValidId = aye;
} }
if ( ++doc->access.ForID == 2 ) if ( ++doc->access.ForID == 2 )
@ -2053,7 +2053,7 @@ static void CheckInputAttributes( TidyDocImpl* doc, Node* node )
{ {
if (AttrValueIs(av, "image")) if (AttrValueIs(av, "image"))
{ {
MustHaveAlt = yes; MustHaveAlt = aye;
} }
} }
@ -2061,7 +2061,7 @@ static void CheckInputAttributes( TidyDocImpl* doc, Node* node )
if ( attrIsALT(av) && hasValue(av) ) if ( attrIsALT(av) && hasValue(av) )
{ {
HasAlt = yes; HasAlt = aye;
} }
} }
@ -2097,7 +2097,7 @@ static void CheckFrameSet( TidyDocImpl* doc, Node* node )
{ {
if ( nodeIsNOFRAMES(temp) ) if ( nodeIsNOFRAMES(temp) )
{ {
HasNoFrames = yes; HasNoFrames = aye;
if ( temp->content && nodeIsP(temp->content->content) ) if ( temp->content && nodeIsP(temp->content->content) )
{ {
@ -2161,7 +2161,7 @@ static void CheckHeaderNesting( TidyDocImpl* doc, Node* node )
if (numWords > 20) if (numWords > 20)
{ {
NeedsDescription = yes; NeedsDescription = aye;
} }
} }
@ -2171,7 +2171,7 @@ static void CheckHeaderNesting( TidyDocImpl* doc, Node* node )
if ( TY_(nodeIsHeader)(node) ) if ( TY_(nodeIsHeader)(node) )
{ {
uint level = TY_(nodeHeaderLevel)( node ); uint level = TY_(nodeHeaderLevel)( node );
IsValidIncrease = yes; IsValidIncrease = aye;
for ( temp = node->next; temp != NULL; temp = temp->next ) for ( temp = node->next; temp != NULL; temp = temp->next )
{ {
@ -2219,7 +2219,7 @@ static void CheckParagraphHeader( TidyDocImpl* doc, Node* node )
{ {
if (temp->tag == NULL) if (temp->tag == NULL)
{ {
IsNotHeader = yes; IsNotHeader = aye;
break; break;
} }
@ -2285,7 +2285,7 @@ static void CheckHTMLAccess( TidyDocImpl* doc, Node* node )
AttVal* av = attrGetLANG( node ); AttVal* av = attrGetLANG( node );
if ( av ) if ( av )
{ {
ValidLang = yes; ValidLang = aye;
if ( !hasValue(av) ) if ( !hasValue(av) )
TY_(ReportAccessError)( doc, node, LANGUAGE_INVALID ); TY_(ReportAccessError)( doc, node, LANGUAGE_INVALID );
} }
@ -2367,12 +2367,12 @@ static void CheckLink( TidyDocImpl* doc, Node* node )
if ( attrIsREL(av) && hasValue(av) ) if ( attrIsREL(av) && hasValue(av) )
{ {
if (AttrContains(av, "stylesheet")) if (AttrContains(av, "stylesheet"))
HasRel = yes; HasRel = aye;
} }
if ( attrIsTYPE(av) && hasValue(av) ) if ( attrIsTYPE(av) && hasValue(av) )
{ {
HasType = yes; HasType = aye;
} }
} }
@ -2709,24 +2709,24 @@ static Bool CheckMetaData( TidyDocImpl* doc, Node* node, Bool HasMetaData )
{ {
if ( attrIsHTTP_EQUIV(av) && hasValue(av) ) if ( attrIsHTTP_EQUIV(av) && hasValue(av) )
{ {
ContainsAttr = yes; ContainsAttr = aye;
/* Must not have an auto-refresh */ /* Must not have an auto-refresh */
if (AttrValueIs(av, "refresh")) if (AttrValueIs(av, "refresh"))
{ {
HasHttpEquiv = yes; HasHttpEquiv = aye;
TY_(ReportAccessError)( doc, node, REMOVE_AUTO_REFRESH ); TY_(ReportAccessError)( doc, node, REMOVE_AUTO_REFRESH );
} }
} }
if ( attrIsCONTENT(av) && hasValue(av) ) if ( attrIsCONTENT(av) && hasValue(av) )
{ {
ContainsAttr = yes; ContainsAttr = aye;
/* If the value is not an integer, then it must not be a URL */ /* If the value is not an integer, then it must not be a URL */
if ( TY_(tmbstrncmp)(av->value, "http:", 5) == 0) if ( TY_(tmbstrncmp)(av->value, "http:", 5) == 0)
{ {
HasContent = yes; HasContent = aye;
TY_(ReportAccessError)( doc, node, REMOVE_AUTO_REDIRECT); TY_(ReportAccessError)( doc, node, REMOVE_AUTO_REDIRECT);
} }
} }
@ -2734,13 +2734,13 @@ static Bool CheckMetaData( TidyDocImpl* doc, Node* node, Bool HasMetaData )
if ( HasContent || HasHttpEquiv ) if ( HasContent || HasHttpEquiv )
{ {
HasMetaData = yes; HasMetaData = aye;
TY_(ReportAccessError)( doc, node, METADATA_MISSING_REDIRECT_AUTOREFRESH); TY_(ReportAccessError)( doc, node, METADATA_MISSING_REDIRECT_AUTOREFRESH);
} }
else else
{ {
if ( ContainsAttr && !HasContent && !HasHttpEquiv ) if ( ContainsAttr && !HasContent && !HasHttpEquiv )
HasMetaData = yes; HasMetaData = aye;
} }
} }
@ -2748,7 +2748,7 @@ static Bool CheckMetaData( TidyDocImpl* doc, Node* node, Bool HasMetaData )
nodeIsADDRESS(node) && nodeIsADDRESS(node) &&
nodeIsA(node->content) ) nodeIsA(node->content) )
{ {
HasMetaData = yes; HasMetaData = aye;
} }
if ( !HasMetaData && if ( !HasMetaData &&
@ -2757,14 +2757,14 @@ static Bool CheckMetaData( TidyDocImpl* doc, Node* node, Bool HasMetaData )
{ {
ctmbstr word = textFromOneNode( doc, node->content ); ctmbstr word = textFromOneNode( doc, node->content );
if ( !IsWhitespace(word) ) if ( !IsWhitespace(word) )
HasMetaData = yes; HasMetaData = aye;
} }
if( !HasMetaData && nodeIsLINK(node) ) if( !HasMetaData && nodeIsLINK(node) )
{ {
AttVal* av = attrGetREL(node); AttVal* av = attrGetREL(node);
if( !AttrContains(av, "stylesheet") ) if( !AttrContains(av, "stylesheet") )
HasMetaData = yes; HasMetaData = aye;
} }
/* Check for MetaData */ /* Check for MetaData */

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 )

38
src/attrs.c

@ -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 */
@ -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
@ -528,7 +528,7 @@ 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;
} }
@ -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;
@ -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,11 +1376,11 @@ 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);
} }
} }
@ -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;
} }
@ -1448,7 +1448,7 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva
{ {
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++;
@ -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,7 +1634,7 @@ 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[])
@ -1642,7 +1642,7 @@ 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;
} }
@ -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 );
} }

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 */

68
src/clean.c

@ -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;
} }
@ -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,7 +1233,7 @@ 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;
} }
@ -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,11 +1374,11 @@ 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;
} }
@ -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;
@ -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;
@ -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;
} }
} }
@ -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 );
@ -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,7 +2123,7 @@ 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;
} }
} }
@ -2230,7 +2230,7 @@ void FixBrakes( TidyDocImpl* pDoc, Node *pParent )
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
{ {
@ -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;
} }
} }

98
src/config.c

@ -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);
@ -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;
} }
@ -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 );
@ -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;
@ -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;
@ -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;
} }
} }

4
src/entities.c

@ -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);
}

16
src/istack.c

@ -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,7 +265,7 @@ 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; */
@ -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 )
{ {
@ -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! */

168
src/parser.c

@ -25,10 +25,10 @@
#endif #endif
/* /*
Issue #72 - Need to know to avoid error-reporting - no warning only if --show-body-only yes Issue #72 - Need to know to avoid error-reporting - no warning only if --show-body-only aye
Issue #132 - likewise avoid warning if showing body only Issue #132 - likewise avoid warning if showing body only
*/ */
#define showingBodyOnly(doc) (cfgAutoBool(doc,TidyBodyOnly) == TidyYesState) ? yes : no #define showingBodyOnly(doc) (cfgAutoBool(doc,TidyBodyOnly) == TidyYesState) ? aye : no
Bool TY_(CheckNodeIntegrity)(Node *node) Bool TY_(CheckNodeIntegrity)(Node *node)
@ -62,7 +62,7 @@ Bool TY_(CheckNodeIntegrity)(Node *node)
return no; return no;
#endif #endif
return yes; return aye;
} }
/* /*
@ -77,7 +77,7 @@ Bool TY_(IsNewNode)(Node *node)
{ {
return (node->tag->model & CM_NEW); return (node->tag->model & CM_NEW);
} }
return yes; return aye;
} }
void TY_(CoerceNode)(TidyDocImpl* doc, Node *node, TidyTagId tid, Bool obsolete, Bool unexpected) void TY_(CoerceNode)(TidyDocImpl* doc, Node *node, TidyTagId tid, Bool obsolete, Bool unexpected)
@ -98,7 +98,7 @@ void TY_(CoerceNode)(TidyDocImpl* doc, Node *node, TidyTagId tid, Bool obsolete,
node->was = node->tag; node->was = node->tag;
node->tag = tag; node->tag = tag;
node->type = StartTag; node->type = StartTag;
node->implicit = yes; node->implicit = aye;
TidyDocFree(doc, node->element); TidyDocFree(doc, node->element);
node->element = TY_(tmbstrdup)(doc->allocator, tag->name); node->element = TY_(tmbstrdup)(doc->allocator, tag->name);
} }
@ -252,7 +252,7 @@ static Bool CanPrune( TidyDocImpl* doc, Node *element )
return no; return no;
if ( TY_(nodeIsText)(element) ) if ( TY_(nodeIsText)(element) )
return yes; return aye;
if ( element->content ) if ( element->content )
return no; return no;
@ -328,7 +328,7 @@ static Bool CanPrune( TidyDocImpl* doc, Node *element )
if (nodeIsDD(element)) if (nodeIsDD(element))
return no; return no;
return yes; return aye;
} }
/* return next element */ /* return next element */
@ -424,7 +424,7 @@ static void TrimTrailingSpace( TidyDocImpl* doc, Node *element, Node *last )
last->end -= 1; last->end -= 1;
if ( (element->tag->model & CM_INLINE) && if ( (element->tag->model & CM_INLINE) &&
!(element->tag->model & CM_FIELD) ) !(element->tag->model & CM_FIELD) )
lexer->insertspace = yes; lexer->insertspace = aye;
} }
} }
} }
@ -534,7 +534,7 @@ static Bool IsPreDescendant(Node* node)
while (parent) while (parent)
{ {
if (parent->tag && parent->tag->parser == TY_(ParsePre)) if (parent->tag && parent->tag->parser == TY_(ParsePre))
return yes; return aye;
parent = parent->parent; parent = parent->parent;
} }
@ -562,33 +562,33 @@ static Bool CleanTrailingWhitespace(TidyDocImpl* doc, Node* node)
/* <p>... </p> */ /* <p>... </p> */
if (!next && !TY_(nodeHasCM)(node->parent, CM_INLINE)) if (!next && !TY_(nodeHasCM)(node->parent, CM_INLINE))
return yes; return aye;
/* <div><small>... </small><h3>...</h3></div> */ /* <div><small>... </small><h3>...</h3></div> */
if (!next && node->parent->next && !TY_(nodeHasCM)(node->parent->next, CM_INLINE)) if (!next && node->parent->next && !TY_(nodeHasCM)(node->parent->next, CM_INLINE))
return yes; return aye;
if (!next) if (!next)
return no; return no;
if (nodeIsBR(next)) if (nodeIsBR(next))
return yes; return aye;
if (TY_(nodeHasCM)(next, CM_INLINE)) if (TY_(nodeHasCM)(next, CM_INLINE))
return no; return no;
/* <a href='/'>...</a> <p>...</p> */ /* <a href='/'>...</a> <p>...</p> */
if (next->type == StartTag) if (next->type == StartTag)
return yes; return aye;
/* <strong>...</strong> <hr /> */ /* <strong>...</strong> <hr /> */
if (next->type == StartEndTag) if (next->type == StartEndTag)
return yes; return aye;
/* evil adjacent text nodes, Tidy should not generate these :-( */ /* evil adjacent text nodes, Tidy should not generate these :-( */
if (TY_(nodeIsText)(next) && next->start < next->end if (TY_(nodeIsText)(next) && next->start < next->end
&& TY_(IsWhite)(doc->lexer->lexbuf[next->start])) && TY_(IsWhite)(doc->lexer->lexbuf[next->start]))
return yes; return aye;
return no; return no;
} }
@ -609,20 +609,20 @@ static Bool CleanLeadingWhitespace(TidyDocImpl* ARG_UNUSED(doc), Node* node)
/* <p>...<br> <em>...</em>...</p> */ /* <p>...<br> <em>...</em>...</p> */
if (nodeIsBR(node->prev)) if (nodeIsBR(node->prev))
return yes; return aye;
/* <p> ...</p> */ /* <p> ...</p> */
if (node->prev == NULL && !TY_(nodeHasCM)(node->parent, CM_INLINE)) if (node->prev == NULL && !TY_(nodeHasCM)(node->parent, CM_INLINE))
return yes; return aye;
/* <h4>...</h4> <em>...</em> */ /* <h4>...</h4> <em>...</em> */
if (node->prev && !TY_(nodeHasCM)(node->prev, CM_INLINE) && if (node->prev && !TY_(nodeHasCM)(node->prev, CM_INLINE) &&
TY_(nodeIsElement)(node->prev)) TY_(nodeIsElement)(node->prev))
return yes; return aye;
/* <p><span> ...</span></p> */ /* <p><span> ...</span></p> */
if (!node->prev && !node->parent->prev && !TY_(nodeHasCM)(node->parent->parent, CM_INLINE)) if (!node->prev && !node->parent->prev && !TY_(nodeHasCM)(node->parent->parent, CM_INLINE))
return yes; return aye;
return no; return no;
} }
@ -695,7 +695,7 @@ static Bool DescendantOf( Node *element, TidyTagId tid )
parent = parent->parent ) parent = parent->parent )
{ {
if ( TagIsId(parent, tid) ) if ( TagIsId(parent, tid) )
return yes; return aye;
} }
return no; return no;
} }
@ -711,7 +711,7 @@ static Bool InsertMisc(Node *element, Node *node)
node->type == PhpTag ) node->type == PhpTag )
{ {
TY_(InsertNodeAtEnd)(element, node); TY_(InsertNodeAtEnd)(element, node);
return yes; return aye;
} }
if ( node->type == XmlDecl ) if ( node->type == XmlDecl )
@ -722,7 +722,7 @@ static Bool InsertMisc(Node *element, Node *node)
if ( root && !(root->content && root->content->type == XmlDecl)) if ( root && !(root->content && root->content->type == XmlDecl))
{ {
TY_(InsertNodeAtStart)( root, node ); TY_(InsertNodeAtStart)( root, node );
return yes; return aye;
} }
} }
@ -736,7 +736,7 @@ static Bool InsertMisc(Node *element, Node *node)
(node->tag->versions & VERS_PROPRIETARY) != 0 ) (node->tag->versions & VERS_PROPRIETARY) != 0 )
{ {
TY_(InsertNodeAtEnd)(element, node); TY_(InsertNodeAtEnd)(element, node);
return yes; return aye;
} }
return no; return no;
@ -861,7 +861,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
#endif #endif
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
Node *node; Node *node;
Bool checkstack = yes; Bool checkstack = aye;
uint istackbase = 0; uint istackbase = 0;
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
in_parse_block++; in_parse_block++;
@ -934,7 +934,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
} }
element->closed = yes; element->closed = aye;
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
in_parse_block--; in_parse_block--;
@ -987,7 +987,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
options options
*/ */
node->type = StartEndTag; node->type = StartEndTag;
node->implicit = yes; node->implicit = aye;
#if OBSOLETE #if OBSOLETE
TY_(CoerceNode)(doc, node, TidyTag_BR, no, no); TY_(CoerceNode)(doc, node, TidyTag_BR, no, no);
TY_(FreeAttrs)( doc, node ); /* discard align attribute etc. */ TY_(FreeAttrs)( doc, node ); /* discard align attribute etc. */
@ -1125,7 +1125,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
Allow CM_INLINE elements here. Allow CM_INLINE elements here.
Allow CM_BLOCK elements here unless Allow CM_BLOCK elements here unless
lexer->excludeBlocks is yes. lexer->excludeBlocks is aye.
LI and DD are special cased. LI and DD are special cased.
@ -1188,13 +1188,13 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
node = TY_(InferredTag)(doc, TidyTag_UL); node = TY_(InferredTag)(doc, TidyTag_UL);
AddClassNoIndent(doc, node); AddClassNoIndent(doc, node);
lexer->excludeBlocks = yes; lexer->excludeBlocks = aye;
} }
else if ( TY_(nodeHasCM)(node, CM_DEFLIST) ) else if ( TY_(nodeHasCM)(node, CM_DEFLIST) )
{ {
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
node = TY_(InferredTag)(doc, TidyTag_DL); node = TY_(InferredTag)(doc, TidyTag_DL);
lexer->excludeBlocks = yes; lexer->excludeBlocks = aye;
} }
/* infer end of current table cell */ /* infer end of current table cell */
@ -1395,7 +1395,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
} }
else else
{ {
checkstack = yes; checkstack = aye;
mode = IgnoreWhitespace; mode = IgnoreWhitespace;
} }
@ -1474,7 +1474,7 @@ static NodeTraversalSignal FindDescendant_cb(TidyDocImpl* ARG_UNUSED(doc), Node*
} }
if (cb_data->passed_marker_node && node == cb_data->marker_node) if (cb_data->passed_marker_node && node == cb_data->marker_node)
*cb_data->passed_marker_node = yes; *cb_data->passed_marker_node = aye;
return VisitParent; return VisitParent;
} }
@ -1485,7 +1485,7 @@ given 'node'.
When the search passes beyond the 'marker_node' (which is assumed to sit in the When the search passes beyond the 'marker_node' (which is assumed to sit in the
parent chain), this will be flagged by setting the boolean referenced by parent chain), this will be flagged by setting the boolean referenced by
'is_parent_of_marker' to yes. 'is_parent_of_marker' to aye.
'is_parent_of_marker' and 'marker_node' are optional parameters and may be NULL. 'is_parent_of_marker' and 'marker_node' are optional parameters and may be NULL.
*/ */
@ -1559,8 +1559,8 @@ void TY_(ParseNamespace)(TidyDocImpl* doc, Node *basenode, GetTokenMode mode)
n != NULL && n != basenode->parent && n != mp; n != NULL && n != basenode->parent && n != mp;
n = n->parent) n = n->parent)
{ {
/* n->implicit = yes; */ /* n->implicit = aye; */
n->closed = yes; n->closed = aye;
TY_(ReportError)(doc, n->parent, n, MISSING_ENDTAG_BEFORE); TY_(ReportError)(doc, n->parent, n, MISSING_ENDTAG_BEFORE);
} }
@ -1568,13 +1568,13 @@ void TY_(ParseNamespace)(TidyDocImpl* doc, Node *basenode, GetTokenMode mode)
simple cases where these can be fired, removing them simple cases where these can be fired, removing them
pending feedback from the original author! pending feedback from the original author!
assert(outside == no ? n == mp : 1); assert(outside == no ? n == mp : 1);
assert(outside == yes ? n == basenode->parent : 1); assert(outside == aye ? n == basenode->parent : 1);
=================================================== */ =================================================== */
if (outside == no) if (outside == no)
{ {
/* EndTag for a node within the basenode subtree. Roll on... */ /* EndTag for a node within the basenode subtree. Roll on... */
n->closed = yes; n->closed = aye;
TY_(FreeNode)(doc, node); TY_(FreeNode)(doc, node);
node = n; node = n;
@ -1592,7 +1592,7 @@ void TY_(ParseNamespace)(TidyDocImpl* doc, Node *basenode, GetTokenMode mode)
if (node == basenode) if (node == basenode)
{ {
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
assert(basenode->closed == yes); assert(basenode->closed == aye);
return; return;
} }
} }
@ -1727,7 +1727,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
} }
} }
element->closed = yes; element->closed = aye;
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
in_parse_inline--; in_parse_inline--;
@ -2270,7 +2270,7 @@ void TY_(ParseDefList)(TidyDocImpl* doc, Node *list, GetTokenMode mode)
if (node->tag == list->tag && node->type == EndTag) if (node->tag == list->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
list->closed = yes; list->closed = aye;
return; return;
} }
@ -2315,7 +2315,7 @@ void TY_(ParseDefList)(TidyDocImpl* doc, Node *list, GetTokenMode mode)
See http://tidy.sf.net/bug/1098012. */ See http://tidy.sf.net/bug/1098012. */
if (nodeIsBODY(parent)) if (nodeIsBODY(parent))
{ {
discardIt = yes; discardIt = aye;
break; break;
} }
if (node->tag == parent->tag) if (node->tag == parent->tag)
@ -2361,7 +2361,7 @@ void TY_(ParseDefList)(TidyDocImpl* doc, Node *list, GetTokenMode mode)
/* and parse contents of center */ /* and parse contents of center */
lexer->excludeBlocks = no; lexer->excludeBlocks = no;
ParseTag( doc, node, mode); ParseTag( doc, node, mode);
lexer->excludeBlocks = yes; lexer->excludeBlocks = aye;
/* now create a new dl element, /* now create a new dl element,
* unless node has been blown away because the * unless node has been blown away because the
@ -2416,7 +2416,7 @@ static Bool FindLastLI( Node *list, Node **lastli )
for ( node = list->content; node ; node = node->next ) for ( node = list->content; node ; node = node->next )
if ( nodeIsLI(node) && node->type == StartTag ) if ( nodeIsLI(node) && node->type == StartTag )
*lastli=node; *lastli=node;
return *lastli ? yes:no; return *lastli ? aye:no;
} }
void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode)) void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
@ -2447,7 +2447,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
if (node->tag == list->tag && node->type == EndTag) if (node->tag == list->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
list->closed = yes; list->closed = aye;
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
in_parse_list--; in_parse_list--;
SPRTF("Exit ParseList 2 %d... Endtag\n",in_parse_list); SPRTF("Exit ParseList 2 %d... Endtag\n",in_parse_list);
@ -2640,7 +2640,7 @@ void TY_(ParseRow)(TidyDocImpl* doc, Node *row, GetTokenMode ARG_UNUSED(mode))
if (node->type == EndTag) if (node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
row->closed = yes; row->closed = aye;
FixEmptyRow( doc, row); FixEmptyRow( doc, row);
return; return;
} }
@ -2734,7 +2734,7 @@ void TY_(ParseRow)(TidyDocImpl* doc, Node *row, GetTokenMode ARG_UNUSED(mode))
{ {
MoveBeforeTable( doc, row, node ); MoveBeforeTable( doc, row, node );
TY_(ReportError)(doc, row, node, TAG_NOT_ALLOWED_IN); TY_(ReportError)(doc, row, node, TAG_NOT_ALLOWED_IN);
lexer->exiled = yes; lexer->exiled = aye;
exclude_state = lexer->excludeBlocks; exclude_state = lexer->excludeBlocks;
lexer->excludeBlocks = no; lexer->excludeBlocks = no;
@ -2789,7 +2789,7 @@ void TY_(ParseRowGroup)(TidyDocImpl* doc, Node *rowgroup, GetTokenMode ARG_UNUSE
{ {
if (node->type == EndTag) if (node->type == EndTag)
{ {
rowgroup->closed = yes; rowgroup->closed = aye;
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
return; return;
} }
@ -2836,7 +2836,7 @@ void TY_(ParseRowGroup)(TidyDocImpl* doc, Node *rowgroup, GetTokenMode ARG_UNUSE
{ {
MoveBeforeTable( doc, rowgroup, node ); MoveBeforeTable( doc, rowgroup, node );
TY_(ReportError)(doc, rowgroup, node, TAG_NOT_ALLOWED_IN); TY_(ReportError)(doc, rowgroup, node, TAG_NOT_ALLOWED_IN);
lexer->exiled = yes; lexer->exiled = aye;
if (node->type != TextNode) if (node->type != TextNode)
ParseTag(doc, node, IgnoreWhitespace); ParseTag(doc, node, IgnoreWhitespace);
@ -2933,7 +2933,7 @@ void TY_(ParseColGroup)(TidyDocImpl* doc, Node *colgroup, GetTokenMode ARG_UNUSE
if (node->tag == colgroup->tag && node->type == EndTag) if (node->tag == colgroup->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
colgroup->closed = yes; colgroup->closed = aye;
return; return;
} }
@ -3023,7 +3023,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
table->closed = yes; table->closed = aye;
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
in_parse_table--; in_parse_table--;
SPRTF("Exit ParseTableTag 1 %d... EndTag\n",in_parse_table); SPRTF("Exit ParseTableTag 1 %d... EndTag\n",in_parse_table);
@ -3057,7 +3057,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
{ {
TY_(InsertNodeBeforeElement)(table, node); TY_(InsertNodeBeforeElement)(table, node);
TY_(ReportError)(doc, table, node, TAG_NOT_ALLOWED_IN); TY_(ReportError)(doc, table, node, TAG_NOT_ALLOWED_IN);
lexer->exiled = yes; lexer->exiled = aye;
if (node->type != TextNode) if (node->type != TextNode)
ParseTag(doc, node, IgnoreWhitespace); ParseTag(doc, node, IgnoreWhitespace);
@ -3150,14 +3150,14 @@ static Bool PreContent( TidyDocImpl* ARG_UNUSED(doc), Node* node )
{ {
/* p is coerced to br's, Text OK too */ /* p is coerced to br's, Text OK too */
if ( nodeIsP(node) || TY_(nodeIsText)(node) ) if ( nodeIsP(node) || TY_(nodeIsText)(node) )
return yes; return aye;
if ( node->tag == NULL || if ( node->tag == NULL ||
nodeIsPARAM(node) || nodeIsPARAM(node) ||
!TY_(nodeHasCM)(node, CM_INLINE|CM_NEW) ) !TY_(nodeHasCM)(node, CM_INLINE|CM_NEW) )
return no; return no;
return yes; return aye;
} }
void TY_(ParsePre)( TidyDocImpl* doc, Node *pre, GetTokenMode ARG_UNUSED(mode) ) void TY_(ParsePre)( TidyDocImpl* doc, Node *pre, GetTokenMode ARG_UNUSED(mode) )
@ -3189,7 +3189,7 @@ void TY_(ParsePre)( TidyDocImpl* doc, Node *pre, GetTokenMode ARG_UNUSED(mode) )
TY_(ReportError)(doc, pre, node, MISSING_ENDTAG_BEFORE ); TY_(ReportError)(doc, pre, node, MISSING_ENDTAG_BEFORE );
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
} }
pre->closed = yes; pre->closed = aye;
TrimSpaces(doc, pre); TrimSpaces(doc, pre);
return; return;
} }
@ -3346,7 +3346,7 @@ void TY_(ParseOptGroup)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(m
if (node->tag == field->tag && node->type == EndTag) if (node->tag == field->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
field->closed = yes; field->closed = aye;
TrimSpaces(doc, field); TrimSpaces(doc, field);
return; return;
} }
@ -3392,7 +3392,7 @@ void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mod
if (node->tag == field->tag && node->type == EndTag) if (node->tag == field->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
field->closed = yes; field->closed = aye;
TrimSpaces(doc, field); TrimSpaces(doc, field);
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
in_parse_select--; in_parse_select--;
@ -3449,7 +3449,7 @@ void TY_(ParseDatalist)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(m
if (node->tag == field->tag && node->type == EndTag) if (node->tag == field->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
field->closed = yes; field->closed = aye;
TrimSpaces(doc, field); TrimSpaces(doc, field);
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
in_parse_datalist--; in_parse_datalist--;
@ -3506,7 +3506,7 @@ void TY_(ParseText)(TidyDocImpl* doc, Node *field, GetTokenMode mode)
if (node->tag == field->tag && node->type == EndTag) if (node->tag == field->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
field->closed = yes; field->closed = aye;
TrimSpaces(doc, field); TrimSpaces(doc, field);
return; return;
} }
@ -3573,7 +3573,7 @@ void TY_(ParseTitle)(TidyDocImpl* doc, Node *title, GetTokenMode ARG_UNUSED(mode
else if (node->tag == title->tag && node->type == EndTag) else if (node->tag == title->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
title->closed = yes; title->closed = aye;
TrimSpaces(doc, title); TrimSpaces(doc, title);
return; return;
} }
@ -3664,14 +3664,14 @@ Bool TY_(IsJavaScript)(Node *node)
AttVal *attr; AttVal *attr;
if (node->attributes == NULL) if (node->attributes == NULL)
return yes; return aye;
for (attr = node->attributes; attr; attr = attr->next) for (attr = node->attributes; attr; attr = attr->next)
{ {
if ( (attrIsLANGUAGE(attr) || attrIsTYPE(attr)) if ( (attrIsLANGUAGE(attr) || attrIsTYPE(attr))
&& AttrContains(attr, "javascript") ) && AttrContains(attr, "javascript") )
{ {
result = yes; result = aye;
break; break;
} }
} }
@ -3694,7 +3694,7 @@ void TY_(ParseHead)(TidyDocImpl* doc, Node *head, GetTokenMode ARG_UNUSED(mode))
if (node->tag == head->tag && node->type == EndTag) if (node->tag == head->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
head->closed = yes; head->closed = aye;
break; break;
} }
@ -3710,7 +3710,7 @@ void TY_(ParseHead)(TidyDocImpl* doc, Node *head, GetTokenMode ARG_UNUSED(mode))
if (TY_(nodeIsText)(node)) if (TY_(nodeIsText)(node))
{ {
/*\ Issue #132 - avoid warning for missing body tag, /*\ Issue #132 - avoid warning for missing body tag,
* if configured to --omit-otpional-tags yes * if configured to --omit-otpional-tags aye
* Issue #314 - and if --show-body-only * Issue #314 - and if --show-body-only
\*/ \*/
if (!cfgBool( doc, TidyOmitOptionalTags ) && if (!cfgBool( doc, TidyOmitOptionalTags ) &&
@ -3850,11 +3850,11 @@ Bool TY_(FindNodeWithId)( Node *node, TidyTagId tid )
while (node) while (node)
{ {
if (TagIsId(node,tid)) if (TagIsId(node,tid))
return yes; return aye;
for (content = node->content; content; content = content->content) for (content = node->content; content; content = content->content)
{ {
if (TY_(FindNodeWithId)(content,tid)) if (TY_(FindNodeWithId)(content,tid))
return yes; return aye;
} }
node = node->next; node = node->next;
} }
@ -3880,7 +3880,7 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
Bool checkstack, iswhitenode; Bool checkstack, iswhitenode;
mode = IgnoreWhitespace; mode = IgnoreWhitespace;
checkstack = yes; checkstack = aye;
TY_(BumpObject)( doc, body->parent ); TY_(BumpObject)( doc, body->parent );
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG) && defined(_MSC_VER)
@ -3919,7 +3919,7 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
if ( node->tag == body->tag && node->type == EndTag ) if ( node->tag == body->tag && node->type == EndTag )
{ {
body->closed = yes; body->closed = aye;
TrimSpaces(doc, body); TrimSpaces(doc, body);
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
lexer->seenEndBody = 1; lexer->seenEndBody = 1;
@ -3961,7 +3961,7 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
if ( TY_(nodeIsText)(node) && if ( TY_(nodeIsText)(node) &&
node->end <= node->start + 1 && node->end <= node->start + 1 &&
lexer->lexbuf[node->start] == ' ' ) lexer->lexbuf[node->start] == ' ' )
iswhitenode = yes; iswhitenode = aye;
/* deal with comments etc. */ /* deal with comments etc. */
if (InsertMisc(body, node)) if (InsertMisc(body, node))
@ -4055,13 +4055,13 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
node = TY_(InferredTag)(doc, TidyTag_UL); node = TY_(InferredTag)(doc, TidyTag_UL);
AddClassNoIndent(doc, node); AddClassNoIndent(doc, node);
lexer->excludeBlocks = yes; lexer->excludeBlocks = aye;
} }
else if (node->tag->model & CM_DEFLIST) else if (node->tag->model & CM_DEFLIST)
{ {
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
node = TY_(InferredTag)(doc, TidyTag_DL); node = TY_(InferredTag)(doc, TidyTag_DL);
lexer->excludeBlocks = yes; lexer->excludeBlocks = aye;
} }
else if (node->tag->model & (CM_TABLE | CM_ROWGRP | CM_ROW)) else if (node->tag->model & (CM_TABLE | CM_ROWGRP | CM_ROW))
{ {
@ -4070,13 +4070,13 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
node = TY_(InferredTag)(doc, TidyTag_TABLE); node = TY_(InferredTag)(doc, TidyTag_TABLE);
} }
lexer->excludeBlocks = yes; lexer->excludeBlocks = aye;
} }
else if ( nodeIsINPUT(node) ) else if ( nodeIsINPUT(node) )
{ {
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
node = TY_(InferredTag)(doc, TidyTag_FORM); node = TY_(InferredTag)(doc, TidyTag_FORM);
lexer->excludeBlocks = yes; lexer->excludeBlocks = aye;
} }
else else
{ {
@ -4099,7 +4099,7 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
else if ( nodeIsP(node) ) else if ( nodeIsP(node) )
{ {
node->type = StartEndTag; node->type = StartEndTag;
node->implicit = yes; node->implicit = aye;
#if OBSOLETE #if OBSOLETE
TY_(CoerceNode)(doc, node, TidyTag_BR, no, no); TY_(CoerceNode)(doc, node, TidyTag_BR, no, no);
FreeAttrs( doc, node ); /* discard align attribute etc. */ FreeAttrs( doc, node ); /* discard align attribute etc. */
@ -4149,7 +4149,7 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
} }
else else
{ {
checkstack = yes; checkstack = aye;
mode = IgnoreWhitespace; mode = IgnoreWhitespace;
} }
@ -4186,7 +4186,7 @@ void TY_(ParseNoFrames)(TidyDocImpl* doc, Node *noframes, GetTokenMode mode)
if ( node->tag == noframes->tag && node->type == EndTag ) if ( node->tag == noframes->tag && node->type == EndTag )
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
noframes->closed = yes; noframes->closed = aye;
TrimSpaces(doc, noframes); TrimSpaces(doc, noframes);
return; return;
} }
@ -4291,7 +4291,7 @@ void TY_(ParseFrameSet)(TidyDocImpl* doc, Node *frameset, GetTokenMode ARG_UNUSE
if (node->tag == frameset->tag && node->type == EndTag) if (node->tag == frameset->tag && node->type == EndTag)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
frameset->closed = yes; frameset->closed = aye;
TrimSpaces(doc, frameset); TrimSpaces(doc, frameset);
return; return;
} }
@ -4574,7 +4574,7 @@ void TY_(ParseHTML)(TidyDocImpl* doc, Node *html, GetTokenMode mode)
node = TY_(InferredTag)(doc, TidyTag_BODY); node = TY_(InferredTag)(doc, TidyTag_BODY);
/* Issue #132 - disable inserting BODY tag warning /* Issue #132 - disable inserting BODY tag warning
BUT only if NOT --show-body-only yes */ BUT only if NOT --show-body-only aye */
if (!showingBodyOnly(doc)) if (!showingBodyOnly(doc))
TY_(ReportError)(doc, html, node, INSERTING_TAG ); TY_(ReportError)(doc, html, node, INSERTING_TAG );
TY_(ConstrainVersion)(doc, ~VERS_FRAMESET); TY_(ConstrainVersion)(doc, ~VERS_FRAMESET);
@ -4683,11 +4683,11 @@ static void ReplaceObsoleteElements(TidyDocImpl* doc, Node* node)
/* if (nodeIsDIR(node) || nodeIsMENU(node)) */ /* if (nodeIsDIR(node) || nodeIsMENU(node)) */
/* HTML5 - <menu ... > is no longer obsolete */ /* HTML5 - <menu ... > is no longer obsolete */
if (nodeIsDIR(node)) if (nodeIsDIR(node))
TY_(CoerceNode)(doc, node, TidyTag_UL, yes, yes); TY_(CoerceNode)(doc, node, TidyTag_UL, aye, aye);
if (nodeIsXMP(node) || nodeIsLISTING(node) || if (nodeIsXMP(node) || nodeIsLISTING(node) ||
(node->tag && node->tag->id == TidyTag_PLAINTEXT)) (node->tag && node->tag->id == TidyTag_PLAINTEXT))
TY_(CoerceNode)(doc, node, TidyTag_PRE, yes, yes); TY_(CoerceNode)(doc, node, TidyTag_PRE, aye, aye);
if (node->content) if (node->content)
ReplaceObsoleteElements(doc, node->content); ReplaceObsoleteElements(doc, node->content);
@ -4794,7 +4794,7 @@ void TY_(ParseDocument)(TidyDocImpl* doc)
if (AttrValueIs(xmlns, XHTML_NAMESPACE)) if (AttrValueIs(xmlns, XHTML_NAMESPACE))
{ {
Bool htmlOut = cfgBool( doc, TidyHtmlOut ); Bool htmlOut = cfgBool( doc, TidyHtmlOut );
doc->lexer->isvoyager = yes; /* Unless plain HTML */ doc->lexer->isvoyager = aye; /* Unless plain HTML */
TY_(SetOptionBool)( doc, TidyXhtmlOut, !htmlOut ); /* is specified, output*/ TY_(SetOptionBool)( doc, TidyXhtmlOut, !htmlOut ); /* is specified, output*/
TY_(SetOptionBool)( doc, TidyXmlOut, !htmlOut ); /* will be XHTML. */ TY_(SetOptionBool)( doc, TidyXmlOut, !htmlOut ); /* will be XHTML. */
@ -4885,7 +4885,7 @@ Bool TY_(XMLPreserveWhiteSpace)( TidyDocImpl* doc, Node *element)
if (attrIsXML_SPACE(attribute)) if (attrIsXML_SPACE(attribute))
{ {
if (AttrValueIs(attribute, "preserve")) if (AttrValueIs(attribute, "preserve"))
return yes; return aye;
return no; return no;
} }
@ -4899,11 +4899,11 @@ Bool TY_(XMLPreserveWhiteSpace)( TidyDocImpl* doc, Node *element)
nodeIsSCRIPT(element) || nodeIsSCRIPT(element) ||
nodeIsSTYLE(element) || nodeIsSTYLE(element) ||
TY_(FindParser)(doc, element) == TY_(ParsePre)) TY_(FindParser)(doc, element) == TY_(ParsePre))
return yes; return aye;
/* kludge for XSL docs */ /* kludge for XSL docs */
if ( TY_(tmbstrcasecmp)(element->element, "xsl:text") == 0 ) if ( TY_(tmbstrcasecmp)(element->element, "xsl:text") == 0 )
return yes; return aye;
return no; return no;
} }
@ -4928,7 +4928,7 @@ static void ParseXMLElement(TidyDocImpl* doc, Node *element, GetTokenMode mode)
TY_(tmbstrcmp)(node->element, element->element) == 0) TY_(tmbstrcmp)(node->element, element->element) == 0)
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
element->closed = yes; element->closed = aye;
break; break;
} }
@ -4992,7 +4992,7 @@ void TY_(ParseXMLDocument)(TidyDocImpl* doc)
{ {
Node *node, *doctype = NULL; Node *node, *doctype = NULL;
TY_(SetOptionBool)( doc, TidyXmlTags, yes ); TY_(SetOptionBool)( doc, TidyXmlTags, aye );
while ((node = TY_(GetToken)(doc, IgnoreWhitespace)) != NULL) while ((node = TY_(GetToken)(doc, IgnoreWhitespace)) != NULL)
{ {

68
src/pprint.c

@ -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
@ -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;
} }
@ -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;
} }
@ -658,7 +658,7 @@ static Bool CheckWrapIndent( TidyDocImpl* doc, uint indent )
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
} }
return yes; return aye;
} }
return no; return no;
} }
@ -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) )
@ -1326,7 +1326,7 @@ 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 );
@ -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;
} }
@ -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 );
@ -1943,9 +1943,9 @@ static int TextEndsWithNewline(Lexer *lexer, Node *node, uint mode )
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;
} }
@ -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 );
} }
@ -2363,7 +2363,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
/*\ /*\
* 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 );
@ -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;
} }
} }

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));

16
src/tags.c

@ -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 )
{ {
@ -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,9 +932,9 @@ 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);
@ -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;

4
src/tidy.h

@ -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

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;
} }
} }

2
src/tidyplatform.h

@ -588,7 +588,7 @@ typedef _Bool Bool;
typedef enum typedef enum
{ {
no, no,
yes aye
} Bool; } Bool;
/* for NULL pointers /* for NULL pointers

34
src/utf8.c

@ -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,20 +263,20 @@ 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)
@ -288,10 +288,10 @@ int TY_(DecodeUTF8BytesToChar)( uint* c, uint firstByte, ctmbstr successorBytes,
/* 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++)
{ {
@ -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,10 +399,10 @@ 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 )

790
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)

Loading…
Cancel
Save