diff --git a/.gitignore b/.gitignore index e6ba39b64..d2d8529d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ Externals +DerivedData example/ios/iOS UI Test/DerivedData scripts/prebuilt.list diff --git a/.gitmodules b/.gitmodules index e69de29bb..6c7ec6d88 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libetpan"] + path = libetpan + url = git@github.com:Marketcircle/libetpan diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj index c07f41e2a..c3bf83009 100755 --- a/build-mac/mailcore2.xcodeproj/project.pbxproj +++ b/build-mac/mailcore2.xcodeproj/project.pbxproj @@ -3,10 +3,13 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ + 0D67FE8A26B3B66600C4D66B /* libctemplate-ios.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D67FE8926B3B65400C4D66B /* libctemplate-ios.xcframework */; }; + 0D67FE9726B43E0300C4D66B /* libtidy.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D67FE9426B43E0300C4D66B /* libtidy.xcframework */; }; + 0D67FEBA26B495E200C4D66B /* sasl.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D67FEB426B495E200C4D66B /* sasl.xcframework */; }; 1820E7D51BD403ED00835D1E /* MCIMAPCustomCommandOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1820E7D31BD403ED00835D1E /* MCIMAPCustomCommandOperation.cpp */; }; 1820E7D61BD403ED00835D1E /* MCIMAPCustomCommandOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1820E7D31BD403ED00835D1E /* MCIMAPCustomCommandOperation.cpp */; }; 184535701BE23FBD000B0D87 /* MCOIMAPCustomCommandOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1845356F1BE23FBD000B0D87 /* MCOIMAPCustomCommandOperation.mm */; }; @@ -1995,55 +1998,27 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 925EB4112330279600DC46DB /* PBXContainerItemProxy */ = { + 0D67FEA526B46B1300C4D66B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */; proxyType = 2; remoteGlobalIDString = 8DC2EF5B0486A6940098B216; remoteInfo = libetpan; }; - 925EB4132330279600DC46DB /* PBXContainerItemProxy */ = { + 0D67FEA726B46B1300C4D66B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */; proxyType = 2; remoteGlobalIDString = C69AB10A10546FE500F32FBD; remoteInfo = "static libetpan"; }; - 925EB4152330279600DC46DB /* PBXContainerItemProxy */ = { + 0D67FEA926B46B1300C4D66B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */; proxyType = 2; remoteGlobalIDString = C682E2C015B315EF00BE9DA7; remoteInfo = "libetpan ios"; }; - 925EB418233027E900DC46DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = C69AB10910546FE500F32FBD; - remoteInfo = "static libetpan"; - }; - 925EB41A233027F500DC46DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = C682E21815B315EF00BE9DA7; - remoteInfo = "libetpan ios"; - }; - 925EB41C2330280100DC46DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 8DC2EF4F0486A6940098B216; - remoteInfo = libetpan; - }; - 925EB41E2330280B00DC46DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = C682E21815B315EF00BE9DA7; - remoteInfo = "libetpan ios"; - }; C600B61E1A244BD8000728F1 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C64EA52E169E772200778456 /* Project object */; @@ -2550,6 +2525,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0D67FE8926B3B65400C4D66B /* libctemplate-ios.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "libctemplate-ios.xcframework"; path = "../deps/ctemplate-ios/lib/libctemplate-ios.xcframework"; sourceTree = ""; }; + 0D67FE9426B43E0300C4D66B /* libtidy.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = libtidy.xcframework; path = "../deps/tidy-html5-ios/lib/libtidy.xcframework"; sourceTree = ""; }; + 0D67FEB426B495E200C4D66B /* sasl.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = sasl.xcframework; path = "sasl.xcframework"; sourceTree = BUILT_PRODUCTS_DIR; }; 1820E7D31BD403ED00835D1E /* MCIMAPCustomCommandOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPCustomCommandOperation.cpp; sourceTree = ""; }; 1820E7D41BD403ED00835D1E /* MCIMAPCustomCommandOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPCustomCommandOperation.h; sourceTree = ""; }; 1845356E1BE23FBD000B0D87 /* MCOIMAPCustomCommandOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPCustomCommandOperation.h; sourceTree = ""; }; @@ -2652,7 +2630,7 @@ 8B0095C81A00DDC500F84BC0 /* MCSMTPLoginOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCSMTPLoginOperation.h; sourceTree = ""; }; 8B0095CA1A00DDE700F84BC0 /* MCOSMTPLoginOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOSMTPLoginOperation.h; sourceTree = ""; }; 8B0095CB1A00DDE700F84BC0 /* MCOSMTPLoginOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOSMTPLoginOperation.mm; sourceTree = ""; }; - 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libetpan.xcodeproj; path = "../../libetpan/build-mac/libetpan.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libetpan.xcodeproj; path = "../libetpan/build-mac/libetpan.xcodeproj"; sourceTree = SOURCE_ROOT; }; 943F1A9817D964F600F0C798 /* MCIMAPConnectOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPConnectOperation.cpp; sourceTree = ""; }; 943F1A9917D964F600F0C798 /* MCIMAPConnectOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPConnectOperation.h; sourceTree = ""; }; 9E774D871767C54E0065EB9B /* MCIMAPFolderStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPFolderStatus.h; sourceTree = ""; }; @@ -3194,7 +3172,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 0D67FE8A26B3B66600C4D66B /* libctemplate-ios.xcframework in Frameworks */, 27780C3D19CF9D9800C77E44 /* CFNetwork.framework in Frameworks */, + 0D67FE9726B43E0300C4D66B /* libtidy.xcframework in Frameworks */, + 0D67FEBA26B495E200C4D66B /* sasl.xcframework in Frameworks */, 27780C3219CF9CD100C77E44 /* Security.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3268,6 +3249,16 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 0D67FE9E26B46B1300C4D66B /* Products */ = { + isa = PBXGroup; + children = ( + 0D67FEA626B46B1300C4D66B /* libetpan.framework */, + 0D67FEA826B46B1300C4D66B /* libetpan.a */, + 0D67FEAA26B46B1300C4D66B /* libetpan-ios.a */, + ); + name = Products; + sourceTree = ""; + }; 8491899A18C93F6E002063A3 /* nntp */ = { isa = PBXGroup; children = ( @@ -3377,16 +3368,6 @@ path = nntp; sourceTree = ""; }; - 925EB40A2330279600DC46DB /* Products */ = { - isa = PBXGroup; - children = ( - 925EB4122330279600DC46DB /* libetpan.framework */, - 925EB4142330279600DC46DB /* libetpan.a */, - 925EB4162330279600DC46DB /* libetpan-ios.a */, - ); - name = Products; - sourceTree = ""; - }; BDCD7C691A70771B0001DCC3 /* icu-ucsdet */ = { isa = PBXGroup; children = ( @@ -3944,6 +3925,9 @@ C64EA78E169F259200778456 /* Frameworks */ = { isa = PBXGroup; children = ( + 0D67FEB426B495E200C4D66B /* sasl.xcframework */, + 0D67FE9426B43E0300C4D66B /* libtidy.xcframework */, + 0D67FE8926B3B65400C4D66B /* libctemplate-ios.xcframework */, 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */, C600B6221A244CC3000728F1 /* CFNetwork.framework */, C6B5AE1119F63496001352A6 /* Foundation.framework */, @@ -4798,7 +4782,6 @@ buildRules = ( ); dependencies = ( - 925EB41F2330280B00DC46DB /* PBXTargetDependency */, ); name = "mailcore ios"; productName = "mailcore framework"; @@ -4836,7 +4819,6 @@ buildRules = ( ); dependencies = ( - 925EB419233027E900DC46DB /* PBXTargetDependency */, ); name = "static mailcore2 osx"; productName = mailcore; @@ -4910,7 +4892,6 @@ buildRules = ( ); dependencies = ( - 925EB41B233027F500DC46DB /* PBXTargetDependency */, ); name = "static mailcore2 ios"; productName = mailcore; @@ -4930,7 +4911,6 @@ buildRules = ( ); dependencies = ( - 925EB41D2330280100DC46DB /* PBXTargetDependency */, ); name = "mailcore osx"; productName = "mailcore framework"; @@ -4967,7 +4947,7 @@ projectDirPath = ""; projectReferences = ( { - ProductGroup = 925EB40A2330279600DC46DB /* Products */; + ProductGroup = 0D67FE9E26B46B1300C4D66B /* Products */; ProjectRef = 9208D60E232C1D08002EF3DA /* libetpan.xcodeproj */; }, ); @@ -4986,25 +4966,25 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - 925EB4122330279600DC46DB /* libetpan.framework */ = { + 0D67FEA626B46B1300C4D66B /* libetpan.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = libetpan.framework; - remoteRef = 925EB4112330279600DC46DB /* PBXContainerItemProxy */; + remoteRef = 0D67FEA526B46B1300C4D66B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 925EB4142330279600DC46DB /* libetpan.a */ = { + 0D67FEA826B46B1300C4D66B /* libetpan.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libetpan.a; - remoteRef = 925EB4132330279600DC46DB /* PBXContainerItemProxy */; + remoteRef = 0D67FEA726B46B1300C4D66B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 925EB4162330279600DC46DB /* libetpan-ios.a */ = { + 0D67FEAA26B46B1300C4D66B /* libetpan-ios.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libetpan-ios.a"; - remoteRef = 925EB4152330279600DC46DB /* PBXContainerItemProxy */; + remoteRef = 0D67FEA926B46B1300C4D66B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ @@ -6171,26 +6151,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 925EB419233027E900DC46DB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "static libetpan"; - targetProxy = 925EB418233027E900DC46DB /* PBXContainerItemProxy */; - }; - 925EB41B233027F500DC46DB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "libetpan ios"; - targetProxy = 925EB41A233027F500DC46DB /* PBXContainerItemProxy */; - }; - 925EB41D2330280100DC46DB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = libetpan; - targetProxy = 925EB41C2330280100DC46DB /* PBXContainerItemProxy */; - }; - 925EB41F2330280B00DC46DB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "libetpan ios"; - targetProxy = 925EB41E2330280B00DC46DB /* PBXContainerItemProxy */; - }; C600B61F1A244BD8000728F1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C64EA536169E772200778456 /* static mailcore2 osx */; @@ -6233,7 +6193,6 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MODULEMAP_FILE = MailCore.modulemap; OTHER_LDFLAGS = ( - "-lctemplate-ios", "-letpan-ios", "-lxml2", "-lsasl2", @@ -6270,7 +6229,6 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MODULEMAP_FILE = MailCore.modulemap; OTHER_LDFLAGS = ( - "-lctemplate-ios", "-letpan-ios", "-lxml2", "-lsasl2", @@ -6405,16 +6363,13 @@ "HEADER_SEARCH_PATHS[sdk=iphoneos*]" = "$(IOS_HEADERS_SEARCH_PATHS)"; "HEADER_SEARCH_PATHS[sdk=iphonesimulator*]" = "$(IOS_HEADERS_SEARCH_PATHS)"; "HEADER_SEARCH_PATHS[sdk=macosx*]" = "$(OSX_HEADERS_SEARCH_PATHS)"; - IOS_HEADERS_SEARCH_PATHS = "\"$(SRCROOT)/../src/core/basetypes/icu-ucsdet/include\" \"$(SRCROOT)/../Externals/libetpan-ios/include\" \"$(SRCROOT)/../Externals/ctemplate-ios/include\" \"$(SRCROOT)/../Externals/tidy-html5-ios/include/tidy\" /usr/include/libxml2"; - IOS_LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Externals/libetpan-ios/lib\" \"$(SRCROOT)/../Externals/ctemplate-ios/lib\" \"$(SRCROOT)/../Externals/libsasl-ios/lib\" \"$(SRCROOT)/../Externals/tidy-html5-ios/lib\""; + IOS_HEADERS_SEARCH_PATHS = "\"$(SRCROOT)/../src/core/basetypes/icu-ucsdet/include\" \"$(SRCROOT)/../deps/libetpan-ios/include\" \"$(SRCROOT)/../deps/ctemplate-ios/include\" \"$(SRCROOT)/../deps/tidy-html5-ios/include/tidy\" /usr/include/libxml2"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = ( "\"$(SRCROOT)/../Externals/libetpan/lib\"", "\"$(SRCROOT)/../Externals/icu4c/lib\"", "\"$(SRCROOT)/../Externals/ctemplate/lib\"", ); - "LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = "$(IOS_LIBRARY_SEARCH_PATHS)"; - "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = "$(IOS_LIBRARY_SEARCH_PATHS)"; "LIBRARY_SEARCH_PATHS[sdk=macosx*]" = "$(OSX_LIBRARY_SEARCH_PATHS)"; ONLY_ACTIVE_ARCH = YES; OSX_HEADERS_SEARCH_PATHS = "\"$(SRCROOT)/../src/core/basetypes/icu-ucsdet/include\" \"$(SRCROOT)/../Externals/libetpan-osx/include\" \"$(SRCROOT)/../Externals/ctemplate-osx/include\" /usr/include/tidy /usr/include/libxml2"; @@ -6449,16 +6404,13 @@ "HEADER_SEARCH_PATHS[sdk=iphoneos*]" = "$(IOS_HEADERS_SEARCH_PATHS)"; "HEADER_SEARCH_PATHS[sdk=iphonesimulator*]" = "$(IOS_HEADERS_SEARCH_PATHS)"; "HEADER_SEARCH_PATHS[sdk=macosx*]" = "$(OSX_HEADERS_SEARCH_PATHS)"; - IOS_HEADERS_SEARCH_PATHS = "\"$(SRCROOT)/../src/core/basetypes/icu-ucsdet/include\" \"$(SRCROOT)/../Externals/libetpan-ios/include\" \"$(SRCROOT)/../Externals/ctemplate-ios/include\" \"$(SRCROOT)/../Externals/tidy-html5-ios/include/tidy\" /usr/include/libxml2"; - IOS_LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Externals/libetpan-ios/lib\" \"$(SRCROOT)/../Externals/ctemplate-ios/lib\" \"$(SRCROOT)/../Externals/libsasl-ios/lib\" \"$(SRCROOT)/../Externals/tidy-html5-ios/lib\""; + IOS_HEADERS_SEARCH_PATHS = "\"$(SRCROOT)/../src/core/basetypes/icu-ucsdet/include\" \"$(SRCROOT)/../deps/libetpan-ios/include\" \"$(SRCROOT)/../deps/ctemplate-ios/include\" \"$(SRCROOT)/../deps/tidy-html5-ios/include/tidy\" /usr/include/libxml2"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LIBRARY_SEARCH_PATHS = ( "\"$(SRCROOT)/../Externals/libetpan/lib\"", "\"$(SRCROOT)/../Externals/icu4c/lib\"", "\"$(SRCROOT)/../Externals/ctemplate/lib\"", ); - "LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = "$(IOS_LIBRARY_SEARCH_PATHS)"; - "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = "$(IOS_LIBRARY_SEARCH_PATHS)"; "LIBRARY_SEARCH_PATHS[sdk=macosx*]" = "$(OSX_LIBRARY_SEARCH_PATHS)"; OSX_HEADERS_SEARCH_PATHS = "\"$(SRCROOT)/../src/core/basetypes/icu-ucsdet/include\" \"$(SRCROOT)/../Externals/libetpan-osx/include\" \"$(SRCROOT)/../Externals/ctemplate-osx/include\" /usr/include/tidy /usr/include/libxml2"; OSX_LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Externals/libetpan-osx/lib\" \"$(SRCROOT)/../Externals/ctemplate-osx/lib\""; @@ -6597,7 +6549,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; INFOPLIST_FILE = ../unittest/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); OTHER_LDFLAGS = ( "$(inherited)", "-framework", @@ -6629,7 +6585,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; INFOPLIST_FILE = ../unittest/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); OTHER_LDFLAGS = ( "$(inherited)", "-framework", diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..4a207581d --- /dev/null +++ b/build.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +DERIVED_DATA_DIR="DerivedData" +PRODUCTS_DIR="${DERIVED_DATA_DIR}/Build/Products" + +# carthage adds these, not sure if necessary +EXTRA_ARGS="ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=" + +# Embed bitcode for iphoneos binaries +EXTRA_IPHONEOS_ARGS="ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode" + +# libetpan has been set up to build an xcframework for libsasl2, however xcframeworks must exist at the *start* of the build process +# I didn't have time to figure out something less awful than building libetpan first +# It'll copy sasl.xcframework to the build directory +xcodebuild -project build-mac/mailcore2.xcodeproj -scheme "libetpan ios" -configuration Release -derivedDataPath ${DERIVED_DATA_DIR} -sdk iphoneos ${EXTRA_ARGS} ${EXTRA_IPHONEOS_ARGS} +xcodebuild -project build-mac/mailcore2.xcodeproj -scheme "libetpan ios" -configuration Release -derivedDataPath ${DERIVED_DATA_DIR} -sdk iphonesimulator ${EXTRA_ARGS} + +# mailcore2 references the sasl.xcframework in the build directory +xcodebuild -project build-mac/mailcore2.xcodeproj -scheme "mailcore ios" -configuration Release -derivedDataPath ${DERIVED_DATA_DIR} -sdk iphoneos ${EXTRA_ARGS} ${EXTRA_IPHONEOS_ARGS} +xcodebuild -project build-mac/mailcore2.xcodeproj -scheme "mailcore ios" -configuration Release -derivedDataPath ${DERIVED_DATA_DIR} -sdk iphonesimulator ${EXTRA_ARGS} + +# glue it all together +# note -debug-symbols path has to be absolute, see https://developer.apple.com/forums/thread/655768 +xcodebuild -create-xcframework \ + -framework "${PRODUCTS_DIR}/Release-iphoneos/MailCore.framework" \ + -debug-symbols "${PWD}/${PRODUCTS_DIR}/Release-iphoneos/MailCore.framework.dSYM" \ + -framework "${PRODUCTS_DIR}/Release-iphonesimulator/MailCore.framework" \ + -debug-symbols "${PWD}/${PRODUCTS_DIR}/Release-iphonesimulator/MailCore.framework.dSYM" \ + -output "${PRODUCTS_DIR}/MailCore.xcframework" diff --git a/deps/ctemplate-ios/include/ctemplate/find_ptr.h b/deps/ctemplate-ios/include/ctemplate/find_ptr.h new file mode 100644 index 000000000..aa1f35f5b --- /dev/null +++ b/deps/ctemplate-ios/include/ctemplate/find_ptr.h @@ -0,0 +1,70 @@ +// Copyright (c) 2012, Olaf van der Spek +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Olaf van der Spek + +#ifndef TEMPLATE_FIND_PTR_H_ +#define TEMPLATE_FIND_PTR_H_ + + + +namespace ctemplate { + +template +typename T::value_type::second_type* find_ptr(T& c, U v) +{ + typename T::iterator i = c.find(v); + return i == c.end() ? NULL : &i->second; +} + +template +const typename T::value_type::second_type* find_ptr(const T& c, U v) +{ + typename T::const_iterator i = c.find(v); + return i == c.end() ? NULL : &i->second; +} + +template +typename T::value_type::second_type find_ptr2(T& c, U v) +{ + typename T::iterator i = c.find(v); + return i == c.end() ? NULL : i->second; +} + +template +const typename T::value_type::second_type find_ptr2(const T& c, U v) +{ + typename T::const_iterator i = c.find(v); + return i == c.end() ? NULL : i->second; +} + +} + +#endif // TEMPLATE_FIND_PTR_H_ diff --git a/deps/ctemplate-ios/include/ctemplate/per_expand_data.h b/deps/ctemplate-ios/include/ctemplate/per_expand_data.h new file mode 100644 index 000000000..607da5f54 --- /dev/null +++ b/deps/ctemplate-ios/include/ctemplate/per_expand_data.h @@ -0,0 +1,149 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: csilvers@google.com (Craig Silverstein) +// +// In addition to a TemplateDictionary, there is also a PerExpandData +// dictionary. This dictionary holds information that applies to one +// call to Expand, such as whether to annotate the template expansion +// output. A template dictionary is associated with a template (.tpl) +// file; a per-expand dictionary is associated to a particular call to +// Expand() in a .cc file. +// +// For (many) more details, see the doc/ directory. + +#ifndef TEMPLATE_PER_EXPAND_DATA_H_ +#define TEMPLATE_PER_EXPAND_DATA_H_ + +#include // for NULL +#include // for strcmp +#include +#include +#include // for StringHash + + + +namespace ctemplate { + +class TemplateModifier; +class TemplateAnnotator; + +class PerExpandData { + public: + PerExpandData() + : annotate_path_(NULL), + annotator_(NULL), + expand_modifier_(NULL), + map_(NULL) { } + + ~PerExpandData(); + + // Indicate that annotations should be inserted during template expansion. + // template_path_start - the start of a template path. When + // printing the filename for template-includes, anything before and + // including template_path_start is elided. This can make the + // output less dependent on filesystem location for template files. + void SetAnnotateOutput(const char* template_path_start) { + annotate_path_ = template_path_start; + } + + // Whether to annotate the expanded output. + bool annotate() const { return annotate_path_ != NULL; } + + // The annotate-path; undefined if annotate() != true + const char* annotate_path() const { return annotate_path_; } + + // This sets the TemplateAnnotator to be used when annotating is on. + // This allows you to override the default text-based annotator + // that will be used if you do not call this. The passed annotator + // will be aliased by this object and returned by annotator(). + // Passing NULL has the special behavior of causing annotator() to + // revert to returning its built-in instance. + void SetAnnotator(TemplateAnnotator* annotator) { + annotator_ = annotator; + } + + // This returns the TemplateAnnotator to be used when annotating is on. + // The value returned will be either an instance previously provided + // to SetAnnotator() or the callable built-in text-based annotator. + TemplateAnnotator* annotator() const; + + // This is a TemplateModifier to be applied to all templates + // expanded via this call to Expand(). That is, this modifier is + // applies to the template (.tpl) file we expand, as well as + // sub-templates that are expanded due to {{>INCLUDE}} directives. + // Caller is responsible for ensuring that modifier exists for the + // lifetime of this object. + void SetTemplateExpansionModifier(const TemplateModifier* modifier) { + expand_modifier_ = modifier; + } + + const TemplateModifier* template_expansion_modifier() const { + return expand_modifier_; + } + + // Store data in this structure, to be used by template modifiers + // (see template_modifiers.h). Call with value set to NULL to clear + // any value previously set. Caller is responsible for ensuring key + // and value point to valid data for the lifetime of this object. + void InsertForModifiers(const char* key, const void* value); + + // Retrieve data specific to this Expand call. Returns NULL if key + // is not found. This should only be used by template modifiers. + const void* LookupForModifiers(const char* key) const; + + // Same as Lookup, but casts the result to a c string. + const char* LookupForModifiersAsString(const char* key) const { + return static_cast(LookupForModifiers(key)); + } + + private: +#ifdef _MSC_VER + typedef std::map DataMap; +#else + struct DataEq { + bool operator()(const char* s1, const char* s2) const; + }; + typedef std::map + DataMap; +#endif + + const char* annotate_path_; + TemplateAnnotator* annotator_; + const TemplateModifier* expand_modifier_; + DataMap* map_; + + PerExpandData(const PerExpandData&); // disallow evil copy constructor + void operator=(const PerExpandData&); // disallow evil operator= +}; + +} + +#endif // TEMPLATE_PER_EXPAND_DATA_H_ diff --git a/deps/ctemplate-ios/include/ctemplate/str_ref.h b/deps/ctemplate-ios/include/ctemplate/str_ref.h new file mode 100644 index 000000000..023d0a854 --- /dev/null +++ b/deps/ctemplate-ios/include/ctemplate/str_ref.h @@ -0,0 +1,129 @@ +// Copyright (c) 2012, Olaf van der Spek +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Olaf van der Spek + +#ifndef TEMPLATE_STR_REF_H_ +#define TEMPLATE_STR_REF_H_ + +#include + + + +namespace ctemplate { + +template +class str_ref_basic +{ +public: + str_ref_basic() + { + clear(); + } + + template + str_ref_basic(const U& c) + { + if (c.end() != c.begin()) + assign(&*c.begin(), c.end() - c.begin() + &*c.begin()); + else + clear(); + } + + str_ref_basic(const void* b, const void* e) + { + assign(b, e); + } + + str_ref_basic(const void* b, size_t sz) + { + assign(b, sz); + } + + str_ref_basic(const char* b) + { + if (b) + assign(b, strlen(b)); + else + clear(); + } + + void clear() + { + begin_ = end_ = NULL; + } + + void assign(const void* b, const void* e) + { + begin_ = reinterpret_cast(b); + end_ = reinterpret_cast(e); + } + + void assign(const void* b, size_t sz) + { + begin_ = reinterpret_cast(b); + end_ = begin_ + sz; + } + + T begin() const + { + return begin_; + } + + T end() const + { + return end_; + } + + T data() const + { + return begin(); + } + + size_t size() const + { + return end() - begin(); + } + + bool empty() const + { + return begin() == end(); + } +private: + T begin_; + T end_; +}; + +typedef str_ref_basic data_ref; +typedef str_ref_basic str_ref; + +} + +#endif // TEMPLATE_STR_REF_H_ diff --git a/deps/ctemplate-ios/include/ctemplate/template.h b/deps/ctemplate-ios/include/ctemplate/template.h new file mode 100644 index 000000000..9d42696a4 --- /dev/null +++ b/deps/ctemplate-ios/include/ctemplate/template.h @@ -0,0 +1,484 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// +// This file implements the Template class. For information about +// how to use this class, and to write the templates it takes as input, +// see the doc/ directory. + +#ifndef CTEMPLATE_TEMPLATE_H_ +#define CTEMPLATE_TEMPLATE_H_ + +#include // for time_t +#include +#include +#include +#include + +// We include this just so folks don't have to include both template.h +// and template_dictionary.h, or template_namelist.h etc, to use the +// template system; we don't actually use anything in these files +// ourselves. +#if 1 +#include +#include +#include +#else +namespace ctemplate { +class TemplateDictionaryInterface; +class PerExpandData; +} +#endif + +namespace google_ctemplate_streamhtmlparser { +class HtmlParser; +} + + + +namespace ctemplate { + +// These free functions form the "simple" template API, and support +// the most common operations (expanding a template from a file, and +// from a string). They all just delegate to a default instance of +// the TemplateCache object. +// +// For more sophisticated use of the template system, you may need +// to create your own TemplateCache object, and work directly with +// it. See template_cache.h for details. + +extern const TemplateCache* default_template_cache(); +extern TemplateCache* mutable_default_template_cache(); + + +// ---- EXPANDING A TEMPLATE ------- +// ExpandTemplate +// ExpandWithData + +// Loads the template named filename from disk if necessary -- it +// gets it from the cache instead, if the template had been loaded +// before or if it had been put explicitly in the cache via a call +// to StringToTemplateCache() -- and expands it using the given +// dictionary. +// The first version is the most general, followed by common-case code. +inline bool ExpandTemplate(const TemplateString& filename, Strip strip, + const TemplateDictionaryInterface *dictionary, + ExpandEmitter* output) { + return mutable_default_template_cache()->ExpandWithData( + filename, strip, dictionary, NULL, output); +} +inline bool ExpandTemplate(const TemplateString& filename, Strip strip, + const TemplateDictionaryInterface* dictionary, + std::string* output_buffer) { + return mutable_default_template_cache()->ExpandWithData( + filename, strip, dictionary, NULL, output_buffer); +} + +// If you want any per-expand data to be used at expand time, call +// this routine instead of Expand. You pass in an extra +// PerExpandData structure (see per_expand_data.h) which sets this +// data: whether or not you want the template to be annotated, and +// any data you want to pass in to template modifers. If +// per_expand_data is NULL, this is exactly the same as Expand(). +// The first version is the most general, followed by common-case code. +inline bool ExpandWithData(const TemplateString& filename, Strip strip, + const TemplateDictionaryInterface *dictionary, + PerExpandData* per_expand_data, + ExpandEmitter* output) { + return mutable_default_template_cache()->ExpandWithData( + filename, strip, dictionary, per_expand_data, output); +} +inline bool ExpandWithData(const TemplateString& filename, Strip strip, + const TemplateDictionaryInterface* dictionary, + PerExpandData* per_expand_data, + std::string* output_buffer) { + return mutable_default_template_cache()->ExpandWithData( + filename, strip, dictionary, per_expand_data, output_buffer); +} + +// ---- INSERTING INTO THE CACHE ------- +// LoadTemplate +// StringToTemplateCache + +// Reads a file from disk and inserts it into the template, if it's +// not already there. Returns true on success or false if the +// template could not be found, or could not be parsed. It's never +// necessary to call this -- Expand() will load templates lazily if +// needed -- but you may want to if you want to make sure templates +// exist before trying to expand them, or because you want to +// control disk access patterns, or for some other reason. +inline bool LoadTemplate(const TemplateString& filename, Strip strip) { + return mutable_default_template_cache()->LoadTemplate(filename, strip); +} + +// Inserts the given string into the default template cache, as if +// it were a file read from disk. You can call Expand() with its +// first arg (filename) the same as the key you use here. You can +// also use this key as the 'filename' for sub-included templates, +// in TemplateDictionary::SetFilename(). +inline bool StringToTemplateCache(const TemplateString& key, + const TemplateString& content, + Strip strip) { + return mutable_default_template_cache()->StringToTemplateCache( + key, content, strip); +} +inline bool StringToTemplateCache(const TemplateString& key, + const char* content, size_t content_len, + Strip strip) { + return mutable_default_template_cache()->StringToTemplateCache( + key, content, content_len, strip); +} + + +// --------------------------------------------------------------------- +// The follow are deprecated. +// TODO(csilvers): move to parsed_template.h + +// TemplateState of a template is: +// - TS_EMPTY before parsing is complete, +// - TS_ERROR if a syntax error was found during parsing, and +// - TS_READY if parsing has completed successfully +// (TS_UNUSED is not used) +enum TemplateState { TS_UNUSED, TS_EMPTY, TS_ERROR, TS_READY }; + +// Used for Auto-Escape. It represents the different contexts a template may +// be initialized in via the AUTOESCAPE pragma in the template file +// (or string). It is only public for testing. The contexts are: +// - TC_HTML: The template contains HTML code. Need not be a complete HTML +// page just content the browser interprets in the context of +// HTML parsing. This should be the most common context to use. +// This mode activates our HTML parser. +// - TC_JS: The template contains raw javascript. If your template +// starts with OR +// +// For variables that are quoted (i.e. string literals) use javascript_escape. +// +// Limitations: +// . NaN, +/-Infinity and null are not recognized. +// . Output is not guaranteed to be a valid literal, +// e.g: +55+-e34 will output as is. +// e.g: trueeee will output nothing as it is not a valid boolean. +// +// Details: +// . For Hex numbers, it checks for case-insensitive 0x[0-9A-F]+ +// that should be a proper check. +// . For other numbers, it checks for case-insensitive [0-9eE+-.]* +// so can also accept invalid numbers such as the number 5..45--10. +// . "true" and "false" (without quotes) are also accepted and that's it. +// +class JavascriptNumber : public TemplateModifier { + MODIFY_SIGNATURE_; +}; +extern JavascriptNumber javascript_number; + +// Escapes characters not in [0-9a-zA-Z.,_:*/~!()-] as %-prefixed hex. +// Space is encoded as a +. +class UrlQueryEscape : public TemplateModifier { + MODIFY_SIGNATURE_; +}; +extern UrlQueryEscape url_query_escape; + +// Escapes " \ / to \" \\ \/ \f \r \n \b \t +// Also escapes < > & to their corresponding \uXXXX representation +// (\u003C, \u003E, \u0026 respectively). +class JsonEscape : public TemplateModifier { + MODIFY_SIGNATURE_; +}; +extern JsonEscape json_escape; + +// Inserts the given prefix (given as the argument to this modifier) +// after every newline in the text. Note that it does *not* insert +// prefix at the very beginning of the text -- in its expected use, +// that prefix will already be present before this text, in the +// template. This is meant to be used internally, and is not exported +// via the g_modifiers list. +class PrefixLine : public TemplateModifier { + MODIFY_SIGNATURE_; +}; +extern PrefixLine prefix_line; + + +#undef MODIFY_SIGNATURE_ + + +// Registers a new template modifier. +// long_name must start with "x-". +// If the modifier takes a value (eg "{{VAR:x-name=value}}"), then +// long_name should end with "=". This is similar to getopt(3) syntax. +// We also allow value-specializations, with specific values specified +// as part of long-name. For instance: +// AddModifier("x-mod=", &my_modifierA); +// AddModifier("x-mod=bar", &my_modifierB); +// AddModifier("x-mod2", &my_modifierC); +// For the template +// {{VAR1:x-mod=foo}} {{VAR2:x-mod=bar}} {{VAR3:x-mod=baz}} {{VAR4:x-mod2}} +// VAR1 and VAR3 would get modified by my_modifierA, VAR2 by my_modifierB, +// and VAR4 by my_modifierC. The order of the AddModifier calls is not +// significant. +extern +bool AddModifier(const char* long_name, const TemplateModifier* modifier); + +// Same as AddModifier() above except that the modifier is considered +// to produce safe output that can be inserted in any context without +// the need for additional escaping. This difference only impacts +// the Auto-Escape mode: In that mode, when a variable (or template-include) +// has a modifier added via AddXssSafeModifier(), it is excluded from +// further escaping, effectively treated as though it had the :none modifier. +// Because Auto-Escape is disabled for any variable and template-include +// that includes such a modifier, use this function with care and ensure +// that it may not emit harmful output that could lead to XSS. +// +// Some valid uses of AddXssSafeModifier: +// . A modifier that converts a string to an integer since +// an integer is generally safe in any context. +// . A modifier that returns one of a fixed number of safe values +// depending on properties of the input. +// +// Some not recommended uses of AddXssSafeModifier: +// . A modifier that applies some extra formatting to the input +// before returning it since the output will still contain +// harmful content if the input does. +// . A modifier that applies one type of escaping to the input +// (say HTML-escape). This may be dangerous when the modifier +// is used in a different context (say Javascript) where this +// escaping may be inadequate. +extern +bool AddXssSafeModifier(const char* long_name, + const TemplateModifier* modifier); + +} + + +#endif // TEMPLATE_TEMPLATE_MODIFIERS_H_ diff --git a/deps/ctemplate-ios/include/ctemplate/template_namelist.h b/deps/ctemplate-ios/include/ctemplate/template_namelist.h new file mode 100644 index 000000000..0cc7b5388 --- /dev/null +++ b/deps/ctemplate-ios/include/ctemplate/template_namelist.h @@ -0,0 +1,164 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// +// This class implements some template helper classes, that manage +// template files and make it easier to monitor them. +// +// For information about how to use these classes and macros, and to +// write the templates it takes as input, +// see the doc/ directory. + +#ifndef TEMPLATE_TEMPLATE_NAMELIST_H_ +#define TEMPLATE_TEMPLATE_NAMELIST_H_ + +#include // for time_t +#include +#include +#include +#include // for Strip +#include // for StringHash + + + +namespace ctemplate { + +// RegisterTemplateFilename +// Used to define a reference variable for the name of a template file. E.g: +// RegisterTemplateFilename(EXAMPLE_FN, "example.tpl"); +// This should be used rather than the seemingly equivalent: +// #define EXAMPLE_FN "example.tpl" +// As in the latter, any call to GetTemplate may then reference the name +// via the first argument. In the example, that would be: +// Template::GetTemplate(EXAMPLE_FN, DO_NOT_STRIP); +// By using this macro, rather than the #define, all templates can +// later be tested for either existence or correct syntax after program +// start-up. +// TODO (we wish): Make this macro produce the #include for the auto-generated +// header files, when and if the macro pre-processor supports that +#define RegisterTemplateFilename(var, name) \ + const char* const var = ::ctemplate::TemplateNamelist::RegisterTemplate(name); + +// Class: TemplateNamelist +// Each time this class is instantiated, the name passed to +// the constructor is added to the class's static list of names. The +// entire list may be retrieved later by calling the GetList accessor +// method. Or they may all be checked for existence or for correct +// syntax via the other methods. We use this in our +// sanity-checking code to make sure all the templates used by a program +// exist and are syntactically correct. + +class TemplateNamelist { + friend class TemporaryRegisterTemplate; + public: + // These types should be taken as 'generic' containers. The only + // thing you should do with them is call size() and/or iterate + // between begin() and end(), and the only operations we promise + // the iterators will support are operator* and operator++. + typedef std::set NameListType; + typedef std::vector MissingListType; + typedef std::vector SyntaxListType; + + public: + // Takes a name and pushes it onto the static namelist + // Returns: a pointer to the entry in namelist which holds the name + static const char* RegisterTemplate(const char* name); + + // GetList + // Description: Returns the collected list of names. + static const NameListType& GetList(); + + // GetMissingList + // If refresh is true or if it is the first time the function is called + // in the execution of the program, it creates (or clears) the missing + // list and then fills it with the list of + // templates that the program knows about but are missing from + // the template directory. + // If refresh is false and it is not the first time the function is + // called, it merely returns the list created in the + // call when the last refresh was done. + // NOTE: The templates are NOT read, parsed, or cached + // by this function. + static const MissingListType& GetMissingList(bool refresh); + + // GetBadSyntaxList + // If refresh is true or if it is the first time the function is called + // in the execution of the program, it creates (or clears) the "bad + // syntax" list and then fills it with the list of + // templates that the program knows about but contain syntax errors. + // A missing file is not considered a syntax error, and thus is + // not included in this list. + // If refresh is false and it is not the first time the function is + // called, it merely returns the list created in the + // call when the last refresh was done. + // NOTE: The side effect of calling this the first time or + // with refresh equal true is that all templates are parsed and cached. + // Hence they need to be retrieved with the flags that + // the program needs them loaded with (i.e, the strip parameter + // passed to Template::GetTemplate.) + static const SyntaxListType& GetBadSyntaxList(bool refresh, Strip strip); + + // GetLastmodTime + // Iterates through all non-missing templates, and returns the latest + // last-modification time for the template files, as returned by stat(). + // This can be used to make sure template files are getting refreshed. + static time_t GetLastmodTime(); + + // AllDoExist + // Retrieves the missing list (always refreshing the list) + // and returns true if it contains any names. + // Else, returns false. + static bool AllDoExist(); + + // IsAllSyntaxOkay + // Retrieves the "bad syntax" list (always refreshing the list) + // and returns true if it contains any names. + // Else, returns false. + // NOTE: The side effect of calling this is that all templates are parsed + // and cached, hence they need to be retrieved with the flags that + // the program needs them loaded with. (I.e, the strip parameter + // ultimately passed to Template::GetTemplate.) + static bool IsAllSyntaxOkay(Strip strip); + + protected: + // The static list of names + static NameListType *namelist_; + static MissingListType *missing_list_; + static SyntaxListType *bad_syntax_list_; + + private: + TemplateNamelist(const TemplateNamelist&); // disallow copying + void operator=(const TemplateNamelist&); +}; + +} + + +#endif // TEMPLATE_TEMPLATE_NAMELIST_H_ diff --git a/deps/ctemplate-ios/include/ctemplate/template_pathops.h b/deps/ctemplate-ios/include/ctemplate/template_pathops.h new file mode 100644 index 000000000..3199fe69c --- /dev/null +++ b/deps/ctemplate-ios/include/ctemplate/template_pathops.h @@ -0,0 +1,73 @@ +// Copyright (c) 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: csilvers@google.com (Craig Silverstein) + +#ifndef TEMPLATE_TEMPLATE_PATHOPS_H_ +#define TEMPLATE_TEMPLATE_PATHOPS_H_ + +#include + + + +namespace ctemplate { + +extern +const char kCWD[]; // a string that's equivalent to "./" +extern +const char kRootdir[]; // a string that's equivalent to "/" + +extern +std::string PathJoin(const std::string& a, const std::string& b); + +extern +bool IsAbspath(const std::string& path); + +extern +bool IsDirectory(const std::string& path); // checks if path ends with / + +extern +void NormalizeDirectory(std::string* dir); // adds trailing / if needed + +extern +std::string Basename(const std::string& path); // everything after last / + +// Returns true iff text contains the word as a full word, i.e. delimited by one +// of [.,_-#*?:] on both the sides. +// This is used while loading a template, to check that the file's name matches +// the auto-escape mode specified by it. +// NOTE: This assumes that the word doesn't contain any of the delimiter +// characters. +extern +bool ContainsFullWord(const std::string& text, const std::string& word); + +} + +#endif // TEMPLATE_TEMPLATE_PATHOPS_H_ diff --git a/deps/ctemplate-ios/include/ctemplate/template_string.h b/deps/ctemplate-ios/include/ctemplate/template_string.h new file mode 100644 index 000000000..9746e87a8 --- /dev/null +++ b/deps/ctemplate-ios/include/ctemplate/template_string.h @@ -0,0 +1,358 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- +// Author: csilvers@google.com (Craig Silerstein) + +#ifndef TEMPLATE_TEMPLATE_STRING_H_ +#define TEMPLATE_TEMPLATE_STRING_H_ + +#include // for memcmp() and size_t +#include +#include +#include + +#include +#if 1 +#include // one place @ac_cv_unit64@ might live +#endif +#if 1 +#include // another place @ac_cv_unit64@ might live +#endif +#include // final place @ac_cv_unit64@ might live + +class TemplateStringTest; // needed for friendship declaration +class StaticTemplateStringTest; + +#if 0 +extern char _start[] __attribute__((weak)); // linker emits: start of .text +extern char data_start[] __attribute__((weak)); // start of .data +#endif + + + +namespace ctemplate { + +// Most methods of TemplateDictionary take a TemplateString rather than a +// C++ string. This is for efficiency: it can avoid extra string copies. +// For any argument that takes a TemplateString, you can pass in any of: +// * A C++ string +// * A char* +// * A StringPiece +// * TemplateString(char*, length) +// The last of these is the most efficient, though it requires more work +// on the call site (you have to create the TemplateString explicitly). +class TemplateString; + +// If you have a string constant (e.g. the string literal "foo") that +// you need to pass into template routines repeatedly, it is more +// efficient if you convert it into a TemplateString only once. The +// way to do this is to use a global StaticTemplateString via STS_INIT +// (note: do this at global scope *only*!): +// static const StaticTemplateString kMyVar = STS_INIT(kMyVar, "MY_VALUE"); +struct StaticTemplateString; + +#define STS_INIT(name, str) STS_INIT_WITH_HASH(name, str, 0) + +// Let's define a convenient hash function for hashing 'normal' +// strings: char* and string. We'll use MurmurHash, which is probably +// better than the STL default. We don't include TemplateString or +// StaticTemplateString here, since they are hashed more efficiently +// based on their id. +struct StringHash { + inline size_t operator()(const char* s) const { + return Hash(s, strlen(s)); + }; + + inline size_t operator()(const std::string& s) const { + return Hash(s.data(), s.size()); + } + + inline bool operator()(const char* a, const char* b) const { + return (a != b) && (strcmp(a, b) < 0); // <, for MSVC + } + + inline bool operator()(const std::string& a, const std::string& b) const { + return a < b; + } + + static const size_t bucket_size = 4; // These are required by MSVC + static const size_t min_buckets = 8; // 4 and 8 are the defaults + private: + size_t Hash(const char* s, size_t slen) const; +}; + +// ----------------------- THE CLASSES ------------------------------- + +typedef u_int64_t TemplateId; + +const TemplateId kIllegalTemplateId = 0; + +struct StaticTemplateString { + // Do not define a constructor! We use only brace-initialization, + // so the data is constructed at static-initialization time. + // Anything you want to put in a constructor, put in + // StaticTemplateStringInitializer instead. + + // These members shouldn't be accessed directly, except in the + // internals of the template code. They are public because that is + // the only way we can brace-initialize them. NOTE: MSVC (at least + // up to 8.0) has a bug where it ignores 'mutable' when it's buried + // in an internal struct. To fix that, we have to make this whole + // internal struct mutable. We only do this on MSVC, so on other + // compilers we get the full constness we want. +#ifdef _MSC_VER + mutable +#endif + struct { + const char* ptr_; + size_t length_; + mutable TemplateId id_; // sometimes lazily-initialized. + } do_not_use_directly_; + + // This class is a good hash functor to pass in as the third + // argument to map<>, when creating a map whose keys are + // StaticTemplateString. NOTE: This class isn't that safe to use, + // because it requires that StaticTemplateStringInitializer has done + // its job. Unfortunately, even when you use the STS_INIT macro + // (which is always, right??), dynamic initialiation does not happen + // in a particular order, and objects in different .cc files may + // reference a StaticTemplateString before the corresponding + // StaticTemplateStringInitializer sets the id. + struct Hasher { + inline size_t operator()(const StaticTemplateString& sts) const; + inline bool operator()(const StaticTemplateString& a, // <, for MSVC + const StaticTemplateString& b) const; + static const size_t bucket_size = 4; // These are required by MSVC + static const size_t min_buckets = 8; // 4 and 8 are the defaults + }; + + inline bool empty() const { + return do_not_use_directly_.length_ == 0; + } + + // Allows comparisons of StaticTemplateString objects as if they were + // strings. This is useful for STL. + inline bool operator==(const StaticTemplateString& x) const; +}; + +class TemplateString { + public: + TemplateString(const char* s) + : ptr_(s ? s : ""), length_(strlen(ptr_)), + is_immutable_(InTextSegment(ptr_)), id_(kIllegalTemplateId) { + } + TemplateString(const std::string& s) + : ptr_(s.data()), length_(s.size()), + is_immutable_(false), id_(kIllegalTemplateId) { + } + TemplateString(const char* s, size_t slen) + : ptr_(s), length_(slen), + is_immutable_(InTextSegment(s)), id_(kIllegalTemplateId) { + } + TemplateString(const StaticTemplateString& s) + : ptr_(s.do_not_use_directly_.ptr_), + length_(s.do_not_use_directly_.length_), + is_immutable_(true), id_(s.do_not_use_directly_.id_) { + } + + const char* begin() const { + return ptr_; + } + + const char* end() const { + return ptr_ + length_; + } + + const char* data() const { + return ptr_; + } + + size_t size() const { + return length_; + } + + inline bool empty() const { + return length_ == 0; + }; + + inline bool is_immutable() const { + return is_immutable_; + } + + // STL requires this to be public for hash_map, though I'd rather not. + inline bool operator==(const TemplateString& x) const { + return GetGlobalId() == x.GetGlobalId(); + } + + private: + // Only TemplateDictionaries and template expansion code can read these. + friend class TemplateDictionary; + friend class TemplateCache; // for GetGlobalId + friend class StaticTemplateStringInitializer; // for AddToGlo... + friend struct TemplateStringHasher; // for GetGlobalId + friend TemplateId GlobalIdForTest(const char* ptr, int len); + friend TemplateId GlobalIdForSTS_INIT(const TemplateString& s); + + TemplateString(const char* s, size_t slen, bool is_immutable, TemplateId id) + : ptr_(s), length_(slen), is_immutable_(is_immutable), id_(id) { + } + + // This returns true if s is in the .text segment of the binary. + // (Note this only checks .text of the main executable, not of + // shared libraries. So it may not be all that useful.) + // This requires the gnu linker (and probably elf), to define + // _start and data_start. + static bool InTextSegment(const char* s) { +#if 0 + return (s >= _start && s < data_start); // in .text +#else + return false; // the conservative choice: assume it's not static memory +#endif + } + + protected: + inline void CacheGlobalId() { // used by HashedTemplateString + id_ = GetGlobalId(); + }; + + private: + // Returns the global id, computing it for the first time if + // necessary. Note that since this is a const method, we don't + // store the computed value in id_, even if id_ is 0. + TemplateId GetGlobalId() const; + // Adds this TemplateString to the map from global-id to name. + void AddToGlobalIdToNameMap(); + + // Use sparingly. Converting to a string loses information about the + // id of the template string, making operations require extra hash + // computations. + std::string ToString() const { return std::string(ptr_, length_); } + + // Does the reverse map from TemplateId to TemplateString contents. + // Returns a TemplateString(kStsEmpty) if id isn't found. Note that + // the TemplateString returned is not necessarily NUL terminated. + static TemplateString IdToString(TemplateId id); + + const char* ptr_; + size_t length_; + // Do we need to manage memory for this string? + bool is_immutable_; + // Id for hash lookups. If 0, we don't have one and it should be + // computed as-needed. + TemplateId id_; +}; + +// ----------------------- THE CODE ------------------------------- + +// Use the low-bit from TemplateId as the "initialized" flag. Note +// that since all initialized TemplateId have the lower bit set, it's +// safe to have used 0 for kIllegalTemplateId, as we did above. +const TemplateId kTemplateStringInitializedFlag = 1; + +inline bool IsTemplateIdInitialized(TemplateId id) { + return id & kTemplateStringInitializedFlag; +} + +// This is a helper struct used in TemplateString::Hasher/TemplateStringHasher +struct TemplateIdHasher { + size_t operator()(TemplateId id) const { + // The shift has two effects: it randomizes the "initialized" flag, + // and slightly improves the randomness of the low bits. This is + // slightly useful when size_t is 32 bits, or when using a small + // hash tables with power-of-2 sizes. + return static_cast(id ^ (id >> 33)); + } + bool operator()(TemplateId a, TemplateId b) const { // <, for MSVC + return a < b; + } + static const size_t bucket_size = 4; // These are required by MSVC + static const size_t min_buckets = 8; // 4 and 8 are the defaults +}; + + +inline size_t StaticTemplateString::Hasher::operator()( + const StaticTemplateString& sts) const { + TemplateId id = sts.do_not_use_directly_.id_; + assert(IsTemplateIdInitialized(id)); + return TemplateIdHasher()(id); +} + +inline bool StaticTemplateString::Hasher::operator()( + const StaticTemplateString& a, const StaticTemplateString& b) const { + TemplateId id_a = a.do_not_use_directly_.id_; + TemplateId id_b = b.do_not_use_directly_.id_; + assert(IsTemplateIdInitialized(id_a)); + assert(IsTemplateIdInitialized(id_b)); + return TemplateIdHasher()(id_a, id_b); +} + +inline bool StaticTemplateString::operator==( + const StaticTemplateString& x) const { + return (do_not_use_directly_.length_ == x.do_not_use_directly_.length_ && + (do_not_use_directly_.ptr_ == x.do_not_use_directly_.ptr_ || + memcmp(do_not_use_directly_.ptr_, x.do_not_use_directly_.ptr_, + do_not_use_directly_.length_) == 0)); +} + +// We set up as much of StaticTemplateString as we can at +// static-initialization time (using brace-initialization), but some +// things can't be set up then. This class is for those things; it +// runs at dynamic-initialization time. If you add logic here, only +// do so as an optimization: this may be called rather late (though +// before main), so other code should not depend on this being called +// before them. +class StaticTemplateStringInitializer { + public: + // This constructor operates on a const StaticTemplateString - we should + // only change those things that are mutable. + explicit StaticTemplateStringInitializer(const StaticTemplateString* sts); +}; + +// Don't use this. This is used only in auto-generated .varnames.h files. +#define STS_INIT_WITH_HASH(name, str, hash) \ + { { str, sizeof("" str "")-1, hash } }; \ + namespace ctemplate_sts_init { \ + static const ::ctemplate::StaticTemplateStringInitializer name##_init(&name); \ + } + +// We computed this hash value for the empty string online. In debug +// mode, we verify it's correct during runtime (that is, that we +// verify the hash function used by make_tpl_varnames_h hasn't changed +// since we computed this number). Note this struct is logically +// static, but since it's in a .h file, we don't say 'static' but +// instead rely on the linker to provide the POD-with-internal-linkage +// magic. +const StaticTemplateString kStsEmpty = + STS_INIT_WITH_HASH(kStsEmpty, "", 1457976849674613049ULL); + +} + + +#endif // TEMPLATE_TEMPLATE_STRING_H_ diff --git a/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/Info.plist b/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/Info.plist new file mode 100644 index 000000000..47792e70d --- /dev/null +++ b/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/Info.plist @@ -0,0 +1,43 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7_armv7s + LibraryPath + libctemplate-ios.a + SupportedArchitectures + + arm64 + armv7 + armv7s + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_i386_x86_64-simulator + LibraryPath + libctemplate-ios.a + SupportedArchitectures + + arm64 + i386 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/ios-arm64_armv7_armv7s/libctemplate-ios.a b/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/ios-arm64_armv7_armv7s/libctemplate-ios.a new file mode 100644 index 000000000..b56e56783 Binary files /dev/null and b/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/ios-arm64_armv7_armv7s/libctemplate-ios.a differ diff --git a/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/ios-arm64_i386_x86_64-simulator/libctemplate-ios.a b/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/ios-arm64_i386_x86_64-simulator/libctemplate-ios.a new file mode 100644 index 000000000..7daaef3a8 Binary files /dev/null and b/deps/ctemplate-ios/lib/libctemplate-ios.xcframework/ios-arm64_i386_x86_64-simulator/libctemplate-ios.a differ diff --git a/deps/tidy-html5-ios/include/tidy/buffio.h b/deps/tidy-html5-ios/include/tidy/buffio.h new file mode 100644 index 000000000..7cacadcff --- /dev/null +++ b/deps/tidy-html5-ios/include/tidy/buffio.h @@ -0,0 +1,112 @@ +#ifndef __TIDY_BUFFIO_H__ +#define __TIDY_BUFFIO_H__ + +/** @file buffio.h - Treat buffer as an I/O stream. + + (c) 1998-2007 (W3C) MIT, ERCIM, Keio University + See tidy.h for the copyright notice. + + Requires buffer to automatically grow as bytes are added. + Must keep track of current read and write points. + +*/ + +#include "platform.h" +#include "tidy.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** TidyBuffer - A chunk of memory */ +TIDY_STRUCT +struct _TidyBuffer +{ + TidyAllocator* allocator; /**< Memory allocator */ + byte* bp; /**< Pointer to bytes */ + uint size; /**< # bytes currently in use */ + uint allocated; /**< # bytes allocated */ + uint next; /**< Offset of current input position */ +}; + +/** Initialize data structure using the default allocator */ +TIDY_EXPORT void TIDY_CALL tidyBufInit( TidyBuffer* buf ); + +/** Initialize data structure using the given custom allocator */ +TIDY_EXPORT void TIDY_CALL tidyBufInitWithAllocator( TidyBuffer* buf, TidyAllocator* allocator ); + +/** Free current buffer, allocate given amount, reset input pointer, + use the default allocator */ +TIDY_EXPORT void TIDY_CALL tidyBufAlloc( TidyBuffer* buf, uint allocSize ); + +/** Free current buffer, allocate given amount, reset input pointer, + use the given custom allocator */ +TIDY_EXPORT void TIDY_CALL tidyBufAllocWithAllocator( TidyBuffer* buf, + TidyAllocator* allocator, + uint allocSize ); + +/** Expand buffer to given size. +** Chunk size is minimum growth. Pass 0 for default of 256 bytes. +*/ +TIDY_EXPORT void TIDY_CALL tidyBufCheckAlloc( TidyBuffer* buf, + uint allocSize, uint chunkSize ); + +/** Free current contents and zero out */ +TIDY_EXPORT void TIDY_CALL tidyBufFree( TidyBuffer* buf ); + +/** Set buffer bytes to 0 */ +TIDY_EXPORT void TIDY_CALL tidyBufClear( TidyBuffer* buf ); + +/** Attach to existing buffer */ +TIDY_EXPORT void TIDY_CALL tidyBufAttach( TidyBuffer* buf, byte* bp, uint size ); + +/** Detach from buffer. Caller must free. */ +TIDY_EXPORT void TIDY_CALL tidyBufDetach( TidyBuffer* buf ); + + +/** Append bytes to buffer. Expand if necessary. */ +TIDY_EXPORT void TIDY_CALL tidyBufAppend( TidyBuffer* buf, void* vp, uint size ); + +/** Append one byte to buffer. Expand if necessary. */ +TIDY_EXPORT void TIDY_CALL tidyBufPutByte( TidyBuffer* buf, byte bv ); + +/** Get byte from end of buffer */ +TIDY_EXPORT int TIDY_CALL tidyBufPopByte( TidyBuffer* buf ); + + +/** Get byte from front of buffer. Increment input offset. */ +TIDY_EXPORT int TIDY_CALL tidyBufGetByte( TidyBuffer* buf ); + +/** At end of buffer? */ +TIDY_EXPORT Bool TIDY_CALL tidyBufEndOfInput( TidyBuffer* buf ); + +/** Put a byte back into the buffer. Decrement input offset. */ +TIDY_EXPORT void TIDY_CALL tidyBufUngetByte( TidyBuffer* buf, byte bv ); + + +/************** + TIDY +**************/ + +/* Forward declarations +*/ + +/** Initialize a buffer input source */ +TIDY_EXPORT void TIDY_CALL tidyInitInputBuffer( TidyInputSource* inp, TidyBuffer* buf ); + +/** Initialize a buffer output sink */ +TIDY_EXPORT void TIDY_CALL tidyInitOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf ); + +#ifdef __cplusplus +} +#endif +#endif /* __TIDY_BUFFIO_H__ */ + +/* + * local variables: + * mode: c + * indent-tabs-mode: nil + * c-basic-offset: 4 + * eval: (c-set-offset 'substatement-open 0) + * end: + */ diff --git a/deps/tidy-html5-ios/include/tidy/platform.h b/deps/tidy-html5-ios/include/tidy/platform.h new file mode 100644 index 000000000..2700f52ca --- /dev/null +++ b/deps/tidy-html5-ios/include/tidy/platform.h @@ -0,0 +1,630 @@ +#ifndef __TIDY_PLATFORM_H__ +#define __TIDY_PLATFORM_H__ + +/* platform.h -- Platform specifics + + (c) 1998-2008 (W3C) MIT, ERCIM, Keio University + See tidy.h for the copyright notice. + +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + Uncomment and edit one of the following #defines if you + want to specify the config file at compile-time. +*/ + +/* #define TIDY_CONFIG_FILE "/etc/tidy_config.txt" */ /* original */ +/* #define TIDY_CONFIG_FILE "/etc/tidyrc" */ +/* #define TIDY_CONFIG_FILE "/etc/tidy.conf" */ + +/* + Uncomment the following #define if you are on a system + supporting the HOME environment variable. + It enables tidy to find config files named ~/.tidyrc if + the HTML_TIDY environment variable is not set. +*/ +/* #define TIDY_USER_CONFIG_FILE "~/.tidyrc" */ + +/* + Uncomment the following #define if your + system supports the call getpwnam(). + E.g. Unix and Linux. + + It enables tidy to find files named + ~your/foo for use in the HTML_TIDY environment + variable or CONFIG_FILE or USER_CONFIGFILE or + on the command line: -config ~joebob/tidy.cfg + + Contributed by Todd Lewis. +*/ + +/* #define SUPPORT_GETPWNAM */ + + +/* Enable/disable support for Big5 and Shift_JIS character encodings */ +#ifndef SUPPORT_ASIAN_ENCODINGS +#define SUPPORT_ASIAN_ENCODINGS 1 +#endif + +/* Enable/disable support for UTF-16 character encodings */ +#ifndef SUPPORT_UTF16_ENCODINGS +#define SUPPORT_UTF16_ENCODINGS 1 +#endif + +/* Enable/disable support for additional accessibility checks */ +#ifndef SUPPORT_ACCESSIBILITY_CHECKS +#define SUPPORT_ACCESSIBILITY_CHECKS 1 +#endif + + +/* Convenience defines for Mac platforms */ + +#if defined(macintosh) +/* Mac OS 6.x/7.x/8.x/9.x, with or without CarbonLib - MPW or Metrowerks 68K/PPC compilers */ +#define MAC_OS_CLASSIC +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Mac OS" +#endif + +/* needed for access() */ +#if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT) +#define NO_ACCESS_SUPPORT +#endif + +#ifdef SUPPORT_GETPWNAM +#undef SUPPORT_GETPWNAM +#endif + +#elif defined(__APPLE__) && defined(__MACH__) +/* Mac OS X (client) 10.x (or server 1.x/10.x) - gcc or Metrowerks MachO compilers */ +#define MAC_OS_X +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Mac OS X" +#endif +#endif + +#if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X) +/* Any OS on Mac platform */ +#define MAC_OS +#define FILENAMES_CASE_SENSITIVE 0 +#define strcasecmp strcmp +#ifndef DFLT_REPL_CHARENC +#define DFLT_REPL_CHARENC MACROMAN +#endif +#endif + +/* Convenience defines for BSD like platforms */ + +#if defined(__FreeBSD__) +#define BSD_BASED_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "FreeBSD" +#endif + +#elif defined(__NetBSD__) +#define BSD_BASED_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "NetBSD" +#endif + +#elif defined(__OpenBSD__) +#define BSD_BASED_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "OpenBSD" +#endif + +#elif defined(__DragonFly__) +#define BSD_BASED_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "DragonFly" +#endif + +#elif defined(__MINT__) +#define BSD_BASED_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "FreeMiNT" +#endif + +#elif defined(__bsdi__) +#define BSD_BASED_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "BSD/OS" +#endif + +#endif + +/* Convenience defines for Windows platforms */ + +#if defined(WINDOWS) || defined(_WIN32) + +#define WINDOWS_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Windows" +#endif + +#if defined(__MWERKS__) || defined(__MSL__) +/* not available with Metrowerks Standard Library */ + +#ifdef SUPPORT_GETPWNAM +#undef SUPPORT_GETPWNAM +#endif + +/* needed for setmode() */ +#if !defined(NO_SETMODE_SUPPORT) +#define NO_SETMODE_SUPPORT +#endif + +#define strcasecmp _stricmp + +#endif + +#if defined(__BORLANDC__) +#define strcasecmp stricmp +#endif + +#define FILENAMES_CASE_SENSITIVE 0 +#define SUPPORT_POSIX_MAPPED_FILES 0 + +#endif + +/* Convenience defines for Linux platforms */ + +#if defined(linux) && defined(__alpha__) +/* Linux on Alpha - gcc compiler */ +#define LINUX_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Linux/Alpha" +#endif + +#elif defined(linux) && defined(__sparc__) +/* Linux on Sparc - gcc compiler */ +#define LINUX_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Linux/Sparc" +#endif + +#elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)) +/* Linux on x86 - gcc compiler */ +#define LINUX_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Linux/x86" +#endif + +#elif defined(linux) && defined(__powerpc__) +/* Linux on PPC - gcc compiler */ +#define LINUX_OS + +#if defined(__linux__) && defined(__powerpc__) + +/* #if #system(linux) */ +/* MkLinux on PPC - gcc (egcs) compiler */ +/* #define MAC_OS_MKLINUX */ +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "MkLinux" +#endif + +#else + +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Linux/PPC" +#endif + +#endif + +#elif defined(linux) || defined(__linux__) +/* generic Linux */ +#define LINUX_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Linux" +#endif + +#endif + +/* Convenience defines for Solaris platforms */ + +#if defined(sun) +#define SOLARIS_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Solaris" +#endif +#endif + +/* Convenience defines for HPUX + gcc platforms */ + +#if defined(__hpux) +#define HPUX_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "HPUX" +#endif +#endif + +/* Convenience defines for RISCOS + gcc platforms */ + +#if defined(__riscos__) +#define RISC_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "RISC OS" +#endif +#endif + +/* Convenience defines for OS/2 + icc/gcc platforms */ + +#if defined(__OS2__) || defined(__EMX__) +#define OS2_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "OS/2" +#endif +#define FILENAMES_CASE_SENSITIVE 0 +#define strcasecmp stricmp +#endif + +/* Convenience defines for IRIX */ + +#if defined(__sgi) +#define IRIX_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "SGI IRIX" +#endif +#endif + +/* Convenience defines for AIX */ + +#if defined(_AIX) +#define AIX_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "IBM AIX" +#endif +#endif + + +/* Convenience defines for BeOS platforms */ + +#if defined(__BEOS__) +#define BE_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "BeOS" +#endif +#endif + +/* Convenience defines for Cygwin platforms */ + +#if defined(__CYGWIN__) +#define CYGWIN_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Cygwin" +#endif +#define FILENAMES_CASE_SENSITIVE 0 +#endif + +/* Convenience defines for OpenVMS */ + +#if defined(__VMS) +#define OPENVMS_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "OpenVMS" +#endif +#define FILENAMES_CASE_SENSITIVE 0 +#endif + +/* Convenience defines for DEC Alpha OSF + gcc platforms */ + +#if defined(__osf__) +#define OSF_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "DEC Alpha OSF" +#endif +#endif + +/* Convenience defines for ARM platforms */ + +#if defined(__arm) +#define ARM_OS + +#if defined(forARM) && defined(__NEWTON_H) + +/* Using Newton C++ Tools ARMCpp compiler */ +#define NEWTON_OS +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "Newton" +#endif + +#else + +#ifndef PLATFORM_NAME +#define PLATFORM_NAME "ARM" +#endif + +#endif + +#endif + +#include +#include +#include /* for longjmp on error exit */ +#include +#include /* may need for Unix V */ +#include +#include + +#ifdef NEEDS_MALLOC_H +#include +#endif + +#ifdef SUPPORT_GETPWNAM +#include +#endif + +#ifdef NEEDS_UNISTD_H +#include /* needed for unlink on some Unix systems */ +#endif + +/* This can be set at compile time. Usually Windows, +** except for Macintosh builds. +*/ +#ifndef DFLT_REPL_CHARENC +#define DFLT_REPL_CHARENC WIN1252 +#endif + +/* By default, use case-sensitive filename comparison. +*/ +#ifndef FILENAMES_CASE_SENSITIVE +#define FILENAMES_CASE_SENSITIVE 1 +#endif + + +/* + Tidy preserves the last modified time for the files it + cleans up. +*/ + +/* + If your platform doesn't support and the + utime() function, or and the futime() + function then set PRESERVE_FILE_TIMES to 0. + + If your platform doesn't support and the + futime() function, then set HAS_FUTIME to 0. + + If your platform supports and the + utime() function requires the file to be + closed first, then set UTIME_NEEDS_CLOSED_FILE to 1. +*/ + +/* Keep old PRESERVEFILETIMES define for compatibility */ +#ifdef PRESERVEFILETIMES +#undef PRESERVE_FILE_TIMES +#define PRESERVE_FILE_TIMES PRESERVEFILETIMES +#endif + +#ifndef PRESERVE_FILE_TIMES +#if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS) +#define PRESERVE_FILE_TIMES 0 +#else +#define PRESERVE_FILE_TIMES 1 +#endif +#endif + +#if PRESERVE_FILE_TIMES + +#ifndef HAS_FUTIME +#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__) +#define HAS_FUTIME 0 +#else +#define HAS_FUTIME 1 +#endif +#endif + +#ifndef UTIME_NEEDS_CLOSED_FILE +#if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS) +#define UTIME_NEEDS_CLOSED_FILE 1 +#else +#define UTIME_NEEDS_CLOSED_FILE 0 +#endif +#endif + +#if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__)) +#include +#include +#else +#include +#endif + +#if HAS_FUTIME +#include +#else +#include +#endif /* HASFUTIME */ + +/* + MS Windows needs _ prefix for Unix file functions. + Not required by Metrowerks Standard Library (MSL). + + Tidy uses following for preserving the last modified time. + + WINDOWS automatically set by Win16 compilers. + _WIN32 automatically set by Win32 compilers. +*/ +#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__) + +#define futime _futime +#define fstat _fstat +#define utimbuf _utimbuf /* Windows seems to want utimbuf */ +#define stat _stat +#define utime _utime +#define vsnprintf _vsnprintf +#endif /* _WIN32 */ + +#endif /* PRESERVE_FILE_TIMES */ + +/* + MS Windows needs _ prefix for Unix file functions. + Not required by Metrowerks Standard Library (MSL). + + WINDOWS automatically set by Win16 compilers. + _WIN32 automatically set by Win32 compilers. +*/ +#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__) + +#ifndef __WATCOMC__ +#define fileno _fileno +#define setmode _setmode +#endif + +#define access _access +#define strcasecmp _stricmp + +#if _MSC_VER > 1000 +#pragma warning( disable : 4189 ) /* local variable is initialized but not referenced */ +#pragma warning( disable : 4100 ) /* unreferenced formal parameter */ +#pragma warning( disable : 4706 ) /* assignment within conditional expression */ +#endif + +#if _MSC_VER > 1300 +#pragma warning( disable : 4996 ) /* disable depreciation warning */ +#endif + +#endif /* _WIN32 */ + +#if defined(_WIN32) + +#if (defined(_USRDLL) || defined(_WINDLL)) && !defined(TIDY_EXPORT) +#define TIDY_EXPORT __declspec( dllexport ) +#endif + +#ifndef TIDY_CALL +#ifdef _WIN64 +# define TIDY_CALL __fastcall +#else +# define TIDY_CALL __stdcall +#endif +#endif + +#endif /* _WIN32 */ + +/* hack for gnu sys/types.h file which defines uint and ulong */ + +#if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS) +#include +#endif +#if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS) +# undef uint +typedef unsigned int uint; +#endif +#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32) +# undef ulong +typedef unsigned long ulong; +#endif + +/* +With GCC 4, __attribute__ ((visibility("default"))) can be used along compiling with tidylib +with "-fvisibility=hidden". See http://gcc.gnu.org/wiki/Visibility and build/gmake/Makefile. +*/ +/* +#if defined(__GNUC__) && __GNUC__ >= 4 +#define TIDY_EXPORT __attribute__ ((visibility("default"))) +#endif +*/ + +#ifndef TIDY_EXPORT /* Define it away for most builds */ +#define TIDY_EXPORT +#endif + +#ifndef TIDY_STRUCT +#define TIDY_STRUCT +#endif + +typedef unsigned char byte; + +typedef uint tchar; /* single, full character */ +typedef char tmbchar; /* single, possibly partial character */ +#ifndef TMBSTR_DEFINED +typedef tmbchar* tmbstr; /* pointer to buffer of possibly partial chars */ +typedef const tmbchar* ctmbstr; /* Ditto, but const */ +#define NULLSTR (tmbstr)"" +#define TMBSTR_DEFINED +#endif + +#ifndef TIDY_CALL +#define TIDY_CALL +#endif + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +# define ARG_UNUSED(x) x __attribute__((unused)) +#else +# define ARG_UNUSED(x) x +#endif + +/* HAS_VSNPRINTF triggers the use of "vsnprintf", which is safe related to + buffer overflow. Therefore, we make it the default unless HAS_VSNPRINTF + has been defined. */ +#ifndef HAS_VSNPRINTF +# define HAS_VSNPRINTF 1 +#endif + +#ifndef SUPPORT_POSIX_MAPPED_FILES +# define SUPPORT_POSIX_MAPPED_FILES 1 +#endif + +/* + bool is a reserved word in some but + not all C++ compilers depending on age + work around is to avoid bool altogether + by introducing a new enum called Bool +*/ +/* We could use the C99 definition where supported +typedef _Bool Bool; +#define no (_Bool)0 +#define yes (_Bool)1 +*/ +typedef enum +{ + no, + yes +} Bool; + +/* for NULL pointers +#define null ((const void*)0) +extern void* null; +*/ + +#if defined(DMALLOC) +#include "dmalloc.h" +#endif + +/* Opaque data structure. +* Cast to implementation type struct within lib. +* This will reduce inter-dependencies/conflicts w/ application code. +*/ +#if 1 +#define opaque_type( typenam )\ +struct _##typenam { int _opaque; };\ +typedef struct _##typenam const * typenam +#else +#define opaque_type(typenam) typedef const void* typenam +#endif + +/* Opaque data structure used to pass back +** and forth to keep current position in a +** list or other collection. +*/ +opaque_type( TidyIterator ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __TIDY_PLATFORM_H__ */ + + +/* + * local variables: + * mode: c + * indent-tabs-mode: nil + * c-basic-offset: 4 + * eval: (c-set-offset 'substatement-open 0) + * end: + */ diff --git a/deps/tidy-html5-ios/include/tidy/tidy.h b/deps/tidy-html5-ios/include/tidy/tidy.h new file mode 100644 index 000000000..100a0a2cb --- /dev/null +++ b/deps/tidy-html5-ios/include/tidy/tidy.h @@ -0,0 +1,1095 @@ +#ifndef __TIDY_H__ +#define __TIDY_H__ + +/** @file tidy.h - Defines HTML Tidy API implemented by tidy library. + + Public interface is const-correct and doesn't explicitly depend + on any globals. Thus, thread-safety may be introduced w/out + changing the interface. + + Looking ahead to a C++ wrapper, C functions always pass + this-equivalent as 1st arg. + + + Copyright (c) 1998-2008 World Wide Web Consortium + (Massachusetts Institute of Technology, European Research + Consortium for Informatics and Mathematics, Keio University). + All Rights Reserved. + + Contributing Author(s): + + Dave Raggett + + The contributing author(s) would like to thank all those who + helped with testing, bug fixes and suggestions for improvements. + This wouldn't have been possible without your help. + + COPYRIGHT NOTICE: + + This software and documentation is provided "as is," and + the copyright holders and contributing author(s) make no + representations or warranties, express or implied, including + but not limited to, warranties of merchantability or fitness + for any particular purpose or that the use of the software or + documentation will not infringe any third party patents, + copyrights, trademarks or other rights. + + The copyright holders and contributing author(s) will not be held + liable for any direct, indirect, special or consequential damages + arising out of any use of the software or documentation, even if + advised of the possibility of such damage. + + Permission is hereby granted to use, copy, modify, and distribute + this source code, or portions hereof, documentation and executables, + for any purpose, without fee, subject to the following restrictions: + + 1. The origin of this source code must not be misrepresented. + 2. Altered versions must be plainly marked as such and must + not be misrepresented as being the original source. + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + The copyright holders and contributing author(s) specifically + permit, without fee, and encourage the use of this source code + as a component for supporting the Hypertext Markup Language in + commercial products. If you use this source code in a product, + acknowledgment is not required but would be appreciated. + + + Created 2001-05-20 by Charles Reitzel + Updated 2002-07-01 by Charles Reitzel - 1st Implementation + +*/ + +#include "platform.h" +#include "tidyenum.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(ANDROID) || defined(__ANDROID__) +typedef unsigned long ulong; +#endif + +/** @defgroup Opaque Opaque Types +** +** Cast to implementation types within lib. +** Reduces inter-dependencies/conflicts w/ application code. +** @{ +*/ + +/** @struct TidyDoc +** Opaque document datatype +*/ +opaque_type( TidyDoc ); + +/** @struct TidyOption +** Opaque option datatype +*/ +opaque_type( TidyOption ); + +/** @struct TidyNode +** Opaque node datatype +*/ +opaque_type( TidyNode ); + +/** @struct TidyAttr +** Opaque attribute datatype +*/ +opaque_type( TidyAttr ); + +/** @} end Opaque group */ + +TIDY_STRUCT struct _TidyBuffer; +typedef struct _TidyBuffer TidyBuffer; + + +/** @defgroup Memory Memory Allocation +** +** Tidy uses a user provided allocator for all +** memory allocations. If this allocator is +** not provided, then a default allocator is +** used which simply wraps standard C malloc/free +** calls. These wrappers call the panic function +** upon any failure. The default panic function +** prints an out of memory message to stderr, and +** calls exit(2). +** +** For applications in which it is unacceptable to +** abort in the case of memory allocation, then the +** panic function can be replaced with one which +** longjmps() out of the tidy code. For this to +** clean up completely, you should be careful not +** to use any tidy methods that open files as these +** will not be closed before panic() is called. +** +** TODO: associate file handles with tidyDoc and +** ensure that tidyDocRelease() can close them all. +** +** Calling the withAllocator() family ( +** tidyCreateWithAllocator, tidyBufInitWithAllocator, +** tidyBufAllocWithAllocator) allow settings custom +** allocators). +** +** All parts of the document use the same allocator. +** Calls that require a user provided buffer can +** optionally use a different allocator. +** +** For reference in designing a plug-in allocator, +** most allocations made by tidy are less than 100 +** bytes, corresponding to attribute names/values, etc. +** +** There is also an additional class of much larger +** allocations which are where most of the data from +** the lexer is stored. (It is not currently possible +** to use a separate allocator for the lexer, this +** would be a useful extension). +** +** In general, approximately 1/3rd of the memory +** used by tidy is freed during the parse, so if +** memory usage is an issue then an allocator that +** can reuse this memory is a good idea. +** +** @{ +*/ + +/** Prototype for the allocator's function table */ +struct _TidyAllocatorVtbl; +/** The allocators function table */ +typedef struct _TidyAllocatorVtbl TidyAllocatorVtbl; + +/** Prototype for the allocator */ +struct _TidyAllocator; +/** The allocator **/ +typedef struct _TidyAllocator TidyAllocator; + +/** An allocator's function table. All functions here must + be provided. + */ +struct _TidyAllocatorVtbl { + /** Called to allocate a block of nBytes of memory */ + void* (TIDY_CALL *alloc)( TidyAllocator *self, size_t nBytes ); + /** Called to resize (grow, in general) a block of memory. + Must support being called with NULL. + */ + void* (TIDY_CALL *realloc)( TidyAllocator *self, void *block, size_t nBytes ); + /** Called to free a previously allocated block of memory */ + void (TIDY_CALL *free)( TidyAllocator *self, void *block); + /** Called when a panic condition is detected. Must support + block == NULL. This function is not called if either alloc + or realloc fails; it is up to the allocator to do this. + Currently this function can only be called if an error is + detected in the tree integrity via the internal function + CheckNodeIntegrity(). This is a situation that can + only arise in the case of a programming error in tidylib. + You can turn off node integrity checking by defining + the constant NO_NODE_INTEGRITY_CHECK during the build. + **/ + void (TIDY_CALL *panic)( TidyAllocator *self, ctmbstr msg ); +}; + +/** An allocator. To create your own allocator, do something like + the following: + + typedef struct _MyAllocator { + TidyAllocator base; + ...other custom allocator state... + } MyAllocator; + + void* MyAllocator_alloc(TidyAllocator *base, void *block, size_t nBytes) + { + MyAllocator *self = (MyAllocator*)base; + ... + } + (etc) + + static const TidyAllocatorVtbl MyAllocatorVtbl = { + MyAllocator_alloc, + MyAllocator_realloc, + MyAllocator_free, + MyAllocator_panic + }; + + myAllocator allocator; + TidyDoc doc; + + allocator.base.vtbl = &MyAllocatorVtbl; + ...initialise allocator specific state... + doc = tidyCreateWithAllocator(&allocator); + ... + + Although this looks slightly long winded, the advantage is that to create + a custom allocator you simply need to set the vtbl pointer correctly. + The vtbl itself can reside in static/global data, and hence does not + need to be initialised each time an allocator is created, and furthermore + the memory is shared amongst all created allocators. +*/ +struct _TidyAllocator { + const TidyAllocatorVtbl *vtbl; +}; + +/** Callback for "malloc" replacement */ +typedef void* (TIDY_CALL *TidyMalloc)( size_t len ); +/** Callback for "realloc" replacement */ +typedef void* (TIDY_CALL *TidyRealloc)( void* buf, size_t len ); +/** Callback for "free" replacement */ +typedef void (TIDY_CALL *TidyFree)( void* buf ); +/** Callback for "out of memory" panic state */ +typedef void (TIDY_CALL *TidyPanic)( ctmbstr mssg ); + + +/** Give Tidy a malloc() replacement */ +TIDY_EXPORT Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc ); +/** Give Tidy a realloc() replacement */ +TIDY_EXPORT Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc ); +/** Give Tidy a free() replacement */ +TIDY_EXPORT Bool TIDY_CALL tidySetFreeCall( TidyFree ffree ); +/** Give Tidy an "out of memory" handler */ +TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic ); + +/** @} end Memory group */ + +/** @defgroup Basic Basic Operations +** +** Tidy public interface +** +** Several functions return an integer document status: +** +**
+** 0    -> SUCCESS
+** >0   -> 1 == TIDY WARNING, 2 == TIDY ERROR
+** <0   -> SEVERE ERROR
+** 
+** +The following is a short example program. + +
+#include <tidy.h>
+#include <buffio.h>
+#include <stdio.h>
+#include <errno.h>
+
+
+int main(int argc, char **argv )
+{
+  const char* input = "<title>Foo</title><p>Foo!";
+  TidyBuffer output;
+  TidyBuffer errbuf;
+  int rc = -1;
+  Bool ok;
+
+  TidyDoc tdoc = tidyCreate();                     // Initialize "document"
+  tidyBufInit( &output );
+  tidyBufInit( &errbuf );
+  printf( "Tidying:\t\%s\\n", input );
+
+  ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes );  // Convert to XHTML
+  if ( ok )
+    rc = tidySetErrorBuffer( tdoc, &errbuf );      // Capture diagnostics
+  if ( rc >= 0 )
+    rc = tidyParseString( tdoc, input );           // Parse the input
+  if ( rc >= 0 )
+    rc = tidyCleanAndRepair( tdoc );               // Tidy it up!
+  if ( rc >= 0 )
+    rc = tidyRunDiagnostics( tdoc );               // Kvetch
+  if ( rc > 1 )                                    // If error, force output.
+    rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 );
+  if ( rc >= 0 )
+    rc = tidySaveBuffer( tdoc, &output );          // Pretty Print
+
+  if ( rc >= 0 )
+  {
+    if ( rc > 0 )
+      printf( "\\nDiagnostics:\\n\\n\%s", errbuf.bp );
+    printf( "\\nAnd here is the result:\\n\\n\%s", output.bp );
+  }
+  else
+    printf( "A severe error (\%d) occurred.\\n", rc );
+
+  tidyBufFree( &output );
+  tidyBufFree( &errbuf );
+  tidyRelease( tdoc );
+  return rc;
+}
+
+** @{ +*/ + +TIDY_EXPORT TidyDoc TIDY_CALL tidyCreate(void); +TIDY_EXPORT TidyDoc TIDY_CALL tidyCreateWithAllocator( TidyAllocator *allocator ); +TIDY_EXPORT void TIDY_CALL tidyRelease( TidyDoc tdoc ); + +/** Let application store a chunk of data w/ each Tidy instance. +** Useful for callbacks. +*/ +TIDY_EXPORT void TIDY_CALL tidySetAppData( TidyDoc tdoc, void* appData ); + +/** Get application data set previously */ +TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc ); + +/** Get release date (version) for current library */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void); + +/* Diagnostics and Repair +*/ + +/** Get status of current document. */ +TIDY_EXPORT int TIDY_CALL tidyStatus( TidyDoc tdoc ); + +/** Detected HTML version: 0, 2, 3 or 4 */ +TIDY_EXPORT int TIDY_CALL tidyDetectedHtmlVersion( TidyDoc tdoc ); + +/** Input is XHTML? */ +TIDY_EXPORT Bool TIDY_CALL tidyDetectedXhtml( TidyDoc tdoc ); + +/** Input is generic XML (not HTML or XHTML)? */ +TIDY_EXPORT Bool TIDY_CALL tidyDetectedGenericXml( TidyDoc tdoc ); + +/** Number of Tidy errors encountered. If > 0, output is suppressed +** unless TidyForceOutput is set. +*/ +TIDY_EXPORT uint TIDY_CALL tidyErrorCount( TidyDoc tdoc ); + +/** Number of Tidy warnings encountered. */ +TIDY_EXPORT uint TIDY_CALL tidyWarningCount( TidyDoc tdoc ); + +/** Number of Tidy accessibility warnings encountered. */ +TIDY_EXPORT uint TIDY_CALL tidyAccessWarningCount( TidyDoc tdoc ); + +/** Number of Tidy configuration errors encountered. */ +TIDY_EXPORT uint TIDY_CALL tidyConfigErrorCount( TidyDoc tdoc ); + +/* Get/Set configuration options +*/ +/** Load an ASCII Tidy configuration file */ +TIDY_EXPORT int TIDY_CALL tidyLoadConfig( TidyDoc tdoc, ctmbstr configFile ); + +/** Load a Tidy configuration file with the specified character encoding */ +TIDY_EXPORT int TIDY_CALL tidyLoadConfigEnc( TidyDoc tdoc, ctmbstr configFile, + ctmbstr charenc ); + +TIDY_EXPORT Bool TIDY_CALL tidyFileExists( TidyDoc tdoc, ctmbstr filename ); + + +/** Set the input/output character encoding for parsing markup. +** Values include: ascii, latin1, raw, utf8, iso2022, mac, +** win1252, utf16le, utf16be, utf16, big5 and shiftjis. Case in-sensitive. +*/ +TIDY_EXPORT int TIDY_CALL tidySetCharEncoding( TidyDoc tdoc, ctmbstr encnam ); + +/** Set the input encoding for parsing markup. +** As for tidySetCharEncoding but only affects the input encoding +**/ +TIDY_EXPORT int TIDY_CALL tidySetInCharEncoding( TidyDoc tdoc, ctmbstr encnam ); + +/** Set the output encoding. +**/ +TIDY_EXPORT int TIDY_CALL tidySetOutCharEncoding( TidyDoc tdoc, ctmbstr encnam ); + +/** @} end Basic group */ + + +/** @defgroup Configuration Configuration Options +** +** Functions for getting and setting Tidy configuration options. +** @{ +*/ + +/** Applications using TidyLib may want to augment command-line and +** configuration file options. Setting this callback allows an application +** developer to examine command-line and configuration file options after +** TidyLib has examined them and failed to recognize them. +**/ + +typedef Bool (TIDY_CALL *TidyOptCallback)( ctmbstr option, ctmbstr value ); + +TIDY_EXPORT Bool TIDY_CALL tidySetOptionCallback( TidyDoc tdoc, TidyOptCallback pOptCallback ); + +/** Get option ID by name */ +TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetIdForName( ctmbstr optnam ); + +/** Get iterator for list of option */ +/** +Example: +
+TidyIterator itOpt = tidyGetOptionList( tdoc );
+while ( itOpt )
+{
+  TidyOption opt = tidyGetNextOption( tdoc, &itOpt );
+  .. get/set option values ..
+}
+
+*/ + +TIDY_EXPORT TidyIterator TIDY_CALL tidyGetOptionList( TidyDoc tdoc ); +/** Get next Option */ +TIDY_EXPORT TidyOption TIDY_CALL tidyGetNextOption( TidyDoc tdoc, TidyIterator* pos ); + +/** Lookup option by ID */ +TIDY_EXPORT TidyOption TIDY_CALL tidyGetOption( TidyDoc tdoc, TidyOptionId optId ); +/** Lookup option by name */ +TIDY_EXPORT TidyOption TIDY_CALL tidyGetOptionByName( TidyDoc tdoc, ctmbstr optnam ); + +/** Get ID of given Option */ +TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetId( TidyOption opt ); + +/** Get name of given Option */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetName( TidyOption opt ); + +/** Get datatype of given Option */ +TIDY_EXPORT TidyOptionType TIDY_CALL tidyOptGetType( TidyOption opt ); + +/** Is Option read-only? */ +TIDY_EXPORT Bool TIDY_CALL tidyOptIsReadOnly( TidyOption opt ); + +/** Get category of given Option */ +TIDY_EXPORT TidyConfigCategory TIDY_CALL tidyOptGetCategory( TidyOption opt ); + +/** Get default value of given Option as a string */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDefault( TidyOption opt ); + +/** Get default value of given Option as an unsigned integer */ +TIDY_EXPORT ulong TIDY_CALL tidyOptGetDefaultInt( TidyOption opt ); + +/** Get default value of given Option as a Boolean value */ +TIDY_EXPORT Bool TIDY_CALL tidyOptGetDefaultBool( TidyOption opt ); + +/** Iterate over Option "pick list" */ +TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetPickList( TidyOption opt ); +/** Get next string value of Option "pick list" */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextPick( TidyOption opt, TidyIterator* pos ); + +/** Get current Option value as a string */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetValue( TidyDoc tdoc, TidyOptionId optId ); +/** Set Option value as a string */ +TIDY_EXPORT Bool TIDY_CALL tidyOptSetValue( TidyDoc tdoc, TidyOptionId optId, ctmbstr val ); +/** Set named Option value as a string. Good if not sure of type. */ +TIDY_EXPORT Bool TIDY_CALL tidyOptParseValue( TidyDoc tdoc, ctmbstr optnam, ctmbstr val ); + +/** Get current Option value as an integer */ +TIDY_EXPORT ulong TIDY_CALL tidyOptGetInt( TidyDoc tdoc, TidyOptionId optId ); +/** Set Option value as an integer */ +TIDY_EXPORT Bool TIDY_CALL tidyOptSetInt( TidyDoc tdoc, TidyOptionId optId, ulong val ); + +/** Get current Option value as a Boolean flag */ +TIDY_EXPORT Bool TIDY_CALL tidyOptGetBool( TidyDoc tdoc, TidyOptionId optId ); +/** Set Option value as a Boolean flag */ +TIDY_EXPORT Bool TIDY_CALL tidyOptSetBool( TidyDoc tdoc, TidyOptionId optId, Bool val ); + +/** Reset option to default value by ID */ +TIDY_EXPORT Bool TIDY_CALL tidyOptResetToDefault( TidyDoc tdoc, TidyOptionId opt ); +/** Reset all options to their default values */ +TIDY_EXPORT Bool TIDY_CALL tidyOptResetAllToDefault( TidyDoc tdoc ); + +/** Take a snapshot of current config settings */ +TIDY_EXPORT Bool TIDY_CALL tidyOptSnapshot( TidyDoc tdoc ); +/** Reset config settings to snapshot (after document processing) */ +TIDY_EXPORT Bool TIDY_CALL tidyOptResetToSnapshot( TidyDoc tdoc ); + +/** Any settings different than default? */ +TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanDefault( TidyDoc tdoc ); +/** Any settings different than snapshot? */ +TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanSnapshot( TidyDoc tdoc ); + +/** Copy current configuration settings from one document to another */ +TIDY_EXPORT Bool TIDY_CALL tidyOptCopyConfig( TidyDoc tdocTo, TidyDoc tdocFrom ); + +/** Get character encoding name. Used with TidyCharEncoding, +** TidyOutCharEncoding, TidyInCharEncoding */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetEncName( TidyDoc tdoc, TidyOptionId optId ); + +/** Get current pick list value for option by ID. Useful for enum types. */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetCurrPick( TidyDoc tdoc, TidyOptionId optId); + +/** Iterate over user declared tags */ +TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc ); +/** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags, +** TidyEmptyTags, TidyPreTags */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc, + TidyOptionId optId, + TidyIterator* iter ); +/** Get option description */ +TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDoc( TidyDoc tdoc, TidyOption opt ); + +/** Iterate over a list of related options */ +TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc tdoc, + TidyOption opt ); +/** Get next related option */ +TIDY_EXPORT TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc, + TidyIterator* pos ); + +/** @} end Configuration group */ + +/** @defgroup IO I/O and Messages +** +** By default, Tidy will define, create and use +** instances of input and output handlers for +** standard C buffered I/O (i.e. FILE* stdin, +** FILE* stdout and FILE* stderr for content +** input, content output and diagnostic output, +** respectively. A FILE* cfgFile input handler +** will be used for config files. Command line +** options will just be set directly. +** +** @{ +*/ + +/***************** + Input Source +*****************/ +/** Input Callback: get next byte of input */ +typedef int (TIDY_CALL *TidyGetByteFunc)( void* sourceData ); + +/** Input Callback: unget a byte of input */ +typedef void (TIDY_CALL *TidyUngetByteFunc)( void* sourceData, byte bt ); + +/** Input Callback: is end of input? */ +typedef Bool (TIDY_CALL *TidyEOFFunc)( void* sourceData ); + +/** End of input "character" */ +#define EndOfStream (~0u) + +/** TidyInputSource - Delivers raw bytes of input +*/ +TIDY_STRUCT +typedef struct _TidyInputSource +{ + /* Instance data */ + void* sourceData; /**< Input context. Passed to callbacks */ + + /* Methods */ + TidyGetByteFunc getByte; /**< Pointer to "get byte" callback */ + TidyUngetByteFunc ungetByte; /**< Pointer to "unget" callback */ + TidyEOFFunc eof; /**< Pointer to "eof" callback */ +} TidyInputSource; + +/** Facilitates user defined source by providing +** an entry point to marshal pointers-to-functions. +** Needed by .NET and possibly other language bindings. +*/ +TIDY_EXPORT Bool TIDY_CALL tidyInitSource( TidyInputSource* source, + void* srcData, + TidyGetByteFunc gbFunc, + TidyUngetByteFunc ugbFunc, + TidyEOFFunc endFunc ); + +/** Helper: get next byte from input source */ +TIDY_EXPORT uint TIDY_CALL tidyGetByte( TidyInputSource* source ); + +/** Helper: unget byte back to input source */ +TIDY_EXPORT void TIDY_CALL tidyUngetByte( TidyInputSource* source, uint byteValue ); + +/** Helper: check if input source at end */ +TIDY_EXPORT Bool TIDY_CALL tidyIsEOF( TidyInputSource* source ); + + +/**************** + Output Sink +****************/ +/** Output callback: send a byte to output */ +typedef void (TIDY_CALL *TidyPutByteFunc)( void* sinkData, byte bt ); + + +/** TidyOutputSink - accepts raw bytes of output +*/ +TIDY_STRUCT +typedef struct _TidyOutputSink +{ + /* Instance data */ + void* sinkData; /**< Output context. Passed to callbacks */ + + /* Methods */ + TidyPutByteFunc putByte; /**< Pointer to "put byte" callback */ +} TidyOutputSink; + +/** Facilitates user defined sinks by providing +** an entry point to marshal pointers-to-functions. +** Needed by .NET and possibly other language bindings. +*/ +TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink, + void* snkData, + TidyPutByteFunc pbFunc ); + +/** Helper: send a byte to output */ +TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue ); + + +/** Callback to filter messages by diagnostic level: +** info, warning, etc. Just set diagnostic output +** handler to redirect all diagnostics output. Return true +** to proceed with output, false to cancel. +*/ +typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl, + uint line, uint col, ctmbstr mssg ); + +/** Give Tidy a filter callback to use */ +TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc, + TidyReportFilter filtCallback ); + +/** Set error sink to named file */ +TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam ); +/** Set error sink to given buffer */ +TIDY_EXPORT int TIDY_CALL tidySetErrorBuffer( TidyDoc tdoc, TidyBuffer* errbuf ); +/** Set error sink to given generic sink */ +TIDY_EXPORT int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink ); + +/** @} end IO group */ + +/* TODO: Catalog all messages for easy translation +TIDY_EXPORT ctmbstr tidyLookupMessage( int errorNo ); +*/ + + + +/** @defgroup Parse Document Parse +** +** Parse markup from a given input source. String and filename +** functions added for convenience. HTML/XHTML version determined +** from input. +** @{ +*/ + +/** Parse markup in named file */ +TIDY_EXPORT int TIDY_CALL tidyParseFile( TidyDoc tdoc, ctmbstr filename ); + +/** Parse markup from the standard input */ +TIDY_EXPORT int TIDY_CALL tidyParseStdin( TidyDoc tdoc ); + +/** Parse markup in given string */ +TIDY_EXPORT int TIDY_CALL tidyParseString( TidyDoc tdoc, ctmbstr content ); + +/** Parse markup in given buffer */ +TIDY_EXPORT int TIDY_CALL tidyParseBuffer( TidyDoc tdoc, TidyBuffer* buf ); + +/** Parse markup in given generic input source */ +TIDY_EXPORT int TIDY_CALL tidyParseSource( TidyDoc tdoc, TidyInputSource* source); + +/** @} End Parse group */ + + +/** @defgroup Clean Diagnostics and Repair +** +** @{ +*/ +/** Execute configured cleanup and repair operations on parsed markup */ +TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc ); + +/** Run configured diagnostics on parsed and repaired markup. +** Must call tidyCleanAndRepair() first. +*/ +TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc ); + +/** @} end Clean group */ + + +/** @defgroup Save Document Save Functions +** +** Save currently parsed document to the given output sink. File name +** and string/buffer functions provided for convenience. +** @{ +*/ + +/** Save to named file */ +TIDY_EXPORT int TIDY_CALL tidySaveFile( TidyDoc tdoc, ctmbstr filename ); + +/** Save to standard output (FILE*) */ +TIDY_EXPORT int TIDY_CALL tidySaveStdout( TidyDoc tdoc ); + +/** Save to given TidyBuffer object */ +TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf ); + +/** Save document to application buffer. If buffer is not big enough, +** ENOMEM will be returned and the necessary buffer size will be placed +** in *buflen. +*/ +TIDY_EXPORT int TIDY_CALL tidySaveString( TidyDoc tdoc, + tmbstr buffer, uint* buflen ); + +/** Save to given generic output sink */ +TIDY_EXPORT int TIDY_CALL tidySaveSink( TidyDoc tdoc, TidyOutputSink* sink ); + +/** @} end Save group */ + + +/** @addtogroup Basic +** @{ +*/ +/** Save current settings to named file. + Only non-default values are written. */ +TIDY_EXPORT int TIDY_CALL tidyOptSaveFile( TidyDoc tdoc, ctmbstr cfgfil ); + +/** Save current settings to given output sink. + Only non-default values are written. */ +TIDY_EXPORT int TIDY_CALL tidyOptSaveSink( TidyDoc tdoc, TidyOutputSink* sink ); + + +/* Error reporting functions +*/ + +/** Write more complete information about errors to current error sink. */ +TIDY_EXPORT void TIDY_CALL tidyErrorSummary( TidyDoc tdoc ); + +/** Write more general information about markup to current error sink. */ +TIDY_EXPORT void TIDY_CALL tidyGeneralInfo( TidyDoc tdoc ); + +/** @} end Basic group (again) */ + + +/** @defgroup Tree Document Tree +** +** A parsed and, optionally, repaired document is +** represented by Tidy as a Tree, much like a W3C DOM. +** This tree may be traversed using these functions. +** The following snippet gives a basic idea how these +** functions can be used. +** +
+void dumpNode( TidyNode tnod, int indent )
+{
+  TidyNode child;
+
+  for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) )
+  {
+    ctmbstr name;
+    switch ( tidyNodeGetType(child) )
+    {
+    case TidyNode_Root:       name = "Root";                    break;
+    case TidyNode_DocType:    name = "DOCTYPE";                 break;
+    case TidyNode_Comment:    name = "Comment";                 break;
+    case TidyNode_ProcIns:    name = "Processing Instruction";  break;
+    case TidyNode_Text:       name = "Text";                    break;
+    case TidyNode_CDATA:      name = "CDATA";                   break;
+    case TidyNode_Section:    name = "XML Section";             break;
+    case TidyNode_Asp:        name = "ASP";                     break;
+    case TidyNode_Jste:       name = "JSTE";                    break;
+    case TidyNode_Php:        name = "PHP";                     break;
+    case TidyNode_XmlDecl:    name = "XML Declaration";         break;
+
+    case TidyNode_Start:
+    case TidyNode_End:
+    case TidyNode_StartEnd:
+    default:
+      name = tidyNodeGetName( child );
+      break;
+    }
+    assert( name != NULL );
+    printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name );
+    dumpNode( child, indent + 4 );
+  }
+}
+
+void dumpDoc( TidyDoc tdoc )
+{
+  dumpNode( tidyGetRoot(tdoc), 0 );
+}
+
+void dumpBody( TidyDoc tdoc )
+{
+  dumpNode( tidyGetBody(tdoc), 0 );
+}
+
+ +@{ + +*/ + +TIDY_EXPORT TidyNode TIDY_CALL tidyGetRoot( TidyDoc tdoc ); +TIDY_EXPORT TidyNode TIDY_CALL tidyGetHtml( TidyDoc tdoc ); +TIDY_EXPORT TidyNode TIDY_CALL tidyGetHead( TidyDoc tdoc ); +TIDY_EXPORT TidyNode TIDY_CALL tidyGetBody( TidyDoc tdoc ); + +/* parent / child */ +TIDY_EXPORT TidyNode TIDY_CALL tidyGetParent( TidyNode tnod ); +TIDY_EXPORT TidyNode TIDY_CALL tidyGetChild( TidyNode tnod ); + +/* siblings */ +TIDY_EXPORT TidyNode TIDY_CALL tidyGetNext( TidyNode tnod ); +TIDY_EXPORT TidyNode TIDY_CALL tidyGetPrev( TidyNode tnod ); + +/* Null for non-element nodes and all pure HTML +TIDY_EXPORT ctmbstr tidyNodeNsLocal( TidyNode tnod ); +TIDY_EXPORT ctmbstr tidyNodeNsPrefix( TidyNode tnod ); +TIDY_EXPORT ctmbstr tidyNodeNsUri( TidyNode tnod ); +*/ + +/* Iterate over attribute values */ +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrFirst( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrNext( TidyAttr tattr ); + +TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrName( TidyAttr tattr ); +TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrValue( TidyAttr tattr ); + +/* Null for pure HTML +TIDY_EXPORT ctmbstr tidyAttrNsLocal( TidyAttr tattr ); +TIDY_EXPORT ctmbstr tidyAttrNsPrefix( TidyAttr tattr ); +TIDY_EXPORT ctmbstr tidyAttrNsUri( TidyAttr tattr ); +*/ + +/** @} end Tree group */ + + +/** @defgroup NodeAsk Node Interrogation +** +** Get information about any givent node. +** @{ +*/ + +/* Node info */ +TIDY_EXPORT TidyNodeType TIDY_CALL tidyNodeGetType( TidyNode tnod ); +TIDY_EXPORT ctmbstr TIDY_CALL tidyNodeGetName( TidyNode tnod ); + +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsText( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsProp( TidyDoc tdoc, TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHeader( TidyNode tnod ); /* h1, h2, ... */ + +TIDY_EXPORT Bool TIDY_CALL tidyNodeHasText( TidyDoc tdoc, TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeGetText( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf ); + +/* Copy the unescaped value of this node into the given TidyBuffer as UTF-8 */ +TIDY_EXPORT Bool TIDY_CALL tidyNodeGetValue( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf ); + +TIDY_EXPORT TidyTagId TIDY_CALL tidyNodeGetId( TidyNode tnod ); + +TIDY_EXPORT uint TIDY_CALL tidyNodeLine( TidyNode tnod ); +TIDY_EXPORT uint TIDY_CALL tidyNodeColumn( TidyNode tnod ); + +/** @defgroup NodeIsElementName Deprecated node interrogation per TagId +** +** @deprecated The functions tidyNodeIs{ElementName} are deprecated and +** should be replaced by tidyNodeGetId. +** @{ +*/ +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHTML( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHEAD( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTITLE( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASE( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMETA( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBODY( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAMESET( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAME( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIFRAME( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOFRAMES( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHR( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH1( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH2( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPRE( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLISTING( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsP( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsUL( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOL( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDL( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIR( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLI( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDT( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDD( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTABLE( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCAPTION( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTD( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTH( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTR( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOL( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOLGROUP( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBR( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsA( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLINK( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsB( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsI( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRONG( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEM( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBIG( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSMALL( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPARAM( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTION( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTGROUP( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIMG( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMAP( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAREA( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOBR( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsWBR( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFONT( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLAYER( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPACER( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCENTER( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTYLE( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSCRIPT( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOSCRIPT( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFORM( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTEXTAREA( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLOCKQUOTE( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAPPLET( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOBJECT( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIV( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPAN( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsINPUT( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsQ( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLABEL( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH3( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH4( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH5( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH6( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsADDRESS( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsXMP( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSELECT( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLINK( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMARQUEE( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEMBED( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASEFONT( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsISINDEX( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsS( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRIKE( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsU( TidyNode tnod ); +TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMENU( TidyNode tnod ); + +/** @} End NodeIsElementName group */ + +/** @} End NodeAsk group */ + + +/** @defgroup Attribute Attribute Interrogation +** +** Get information about any given attribute. +** @{ +*/ + +TIDY_EXPORT TidyAttrId TIDY_CALL tidyAttrGetId( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsEvent( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr ); + +/** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId +** +** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and +** should be replaced by tidyAttrGetId. +** @{ +*/ +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHREF( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSRC( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsID( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsNAME( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSUMMARY( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALT( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLONGDESC( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsUSEMAP( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsISMAP( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANGUAGE( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTYPE( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVALUE( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCONTENT( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTITLE( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsXMLNS( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsDATAFLD( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsWIDTH( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHEIGHT( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsFOR( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSELECTED( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCHECKED( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANG( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTARGET( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHTTP_EQUIV( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsREL( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEUP( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnCLICK( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOVER( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOUT( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYDOWN( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYUP( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYPRESS( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnFOCUS( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnBLUR( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsBGCOLOR( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLINK( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALINK( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVLINK( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTEXT( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSTYLE( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsABBR( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCOLSPAN( TidyAttr tattr ); +TIDY_EXPORT Bool TIDY_CALL tidyAttrIsROWSPAN( TidyAttr tattr ); + +/** @} End AttrIsAttributeName group */ + +/** @} end AttrAsk group */ + + +/** @defgroup AttrGet Attribute Retrieval +** +** Lookup an attribute from a given node +** @{ +*/ + +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetById( TidyNode tnod, TidyAttrId attId ); + +/** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId +** +** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and +** should be replaced by tidyAttrGetById. +** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by +** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential +** name clash with tidyAttrGetId for case-insensitive languages. +** @{ +*/ +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHREF( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSRC( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetID( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetNAME( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSUMMARY( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALT( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLONGDESC( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetUSEMAP( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetISMAP( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANGUAGE( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTYPE( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVALUE( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCONTENT( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTITLE( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetXMLNS( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetDATAFLD( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetWIDTH( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHEIGHT( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetFOR( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSELECTED( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCHECKED( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANG( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTARGET( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHTTP_EQUIV( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetREL( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEMOVE( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEDOWN( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEUP( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnCLICK( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOVER( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOUT( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYDOWN( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYUP( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYPRESS( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnFOCUS( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnBLUR( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetBGCOLOR( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLINK( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALINK( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVLINK( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTEXT( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSTYLE( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetABBR( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCOLSPAN( TidyNode tnod ); +TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod ); + +/** @} End AttrGetAttributeName group */ + +/** @} end AttrGet group */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif +#endif /* __TIDY_H__ */ + +/* + * local variables: + * mode: c + * indent-tabs-mode: nil + * c-basic-offset: 4 + * eval: (c-set-offset 'substatement-open 0) + * end: + */ diff --git a/deps/tidy-html5-ios/include/tidy/tidyenum.h b/deps/tidy-html5-ios/include/tidy/tidyenum.h new file mode 100644 index 000000000..6066e3b46 --- /dev/null +++ b/deps/tidy-html5-ios/include/tidy/tidyenum.h @@ -0,0 +1,749 @@ +#ifndef __TIDYENUM_H__ +#define __TIDYENUM_H__ + +/* @file tidyenum.h -- Split public enums into separate header + + Simplifies enum re-use in various wrappers. e.g. SWIG + generated wrappers and COM IDL files. + + Copyright (c) 1998-2008 World Wide Web Consortium + (Massachusetts Institute of Technology, European Research + Consortium for Informatics and Mathematics, Keio University). + All Rights Reserved. + + Contributing Author(s): + + Dave Raggett + + The contributing author(s) would like to thank all those who + helped with testing, bug fixes and suggestions for improvements. + This wouldn't have been possible without your help. + + COPYRIGHT NOTICE: + + This software and documentation is provided "as is," and + the copyright holders and contributing author(s) make no + representations or warranties, express or implied, including + but not limited to, warranties of merchantability or fitness + for any particular purpose or that the use of the software or + documentation will not infringe any third party patents, + copyrights, trademarks or other rights. + + The copyright holders and contributing author(s) will not be held + liable for any direct, indirect, special or consequential damages + arising out of any use of the software or documentation, even if + advised of the possibility of such damage. + + Permission is hereby granted to use, copy, modify, and distribute + this source code, or portions hereof, documentation and executables, + for any purpose, without fee, subject to the following restrictions: + + 1. The origin of this source code must not be misrepresented. + 2. Altered versions must be plainly marked as such and must + not be misrepresented as being the original source. + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + The copyright holders and contributing author(s) specifically + permit, without fee, and encourage the use of this source code + as a component for supporting the Hypertext Markup Language in + commercial products. If you use this source code in a product, + acknowledgment is not required but would be appreciated. + + + Created 2001-05-20 by Charles Reitzel + Updated 2002-07-01 by Charles Reitzel - 1st Implementation + +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Enumerate configuration options +*/ + +/** Categories of Tidy configuration options +*/ +typedef enum +{ + TidyMarkup, /**< Markup options: (X)HTML version, etc */ + TidyDiagnostics, /**< Diagnostics */ + TidyPrettyPrint, /**< Output layout */ + TidyEncoding, /**< Character encodings */ + TidyMiscellaneous /**< File handling, message format, etc. */ +} TidyConfigCategory; + + +/** Option IDs Used to get/set option values. +*/ +typedef enum +{ + TidyUnknownOption, /**< Unknown option! */ + TidyIndentSpaces, /**< Indentation n spaces */ + TidyWrapLen, /**< Wrap margin */ + TidyTabSize, /**< Expand tabs to n spaces */ + + TidyCharEncoding, /**< In/out character encoding */ + TidyInCharEncoding, /**< Input character encoding (if different) */ + TidyOutCharEncoding, /**< Output character encoding (if different) */ + TidyNewline, /**< Output line ending (default to platform) */ + + TidyDoctypeMode, /**< See doctype property */ + TidyDoctype, /**< User specified doctype */ + + TidyDuplicateAttrs, /**< Keep first or last duplicate attribute */ + TidyAltText, /**< Default text for alt attribute */ + + /* obsolete */ + TidySlideStyle, /**< Style sheet for slides: not used for anything yet */ + + TidyErrFile, /**< File name to write errors to */ + TidyOutFile, /**< File name to write markup to */ + TidyWriteBack, /**< If true then output tidied markup */ + TidyShowMarkup, /**< If false, normal output is suppressed */ + TidyShowInfo, /**< If true, info-level messages are shown */ + TidyShowWarnings, /**< However errors are always shown */ + TidyQuiet, /**< No 'Parsing X', guessed DTD or summary */ + TidyIndentContent, /**< Indent content of appropriate tags */ + /**< "auto" does text/block level content indentation */ + TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */ + TidyOmitOptionalTags,/**< Suppress optional start tags and end tags */ + TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */ + TidyXmlTags, /**< Treat input as XML */ + TidyXmlOut, /**< Create output as XML */ + TidyXhtmlOut, /**< Output extensible HTML */ + TidyHtmlOut, /**< Output plain HTML, even for XHTML input. + Yes means set explicitly. */ + TidyXmlDecl, /**< Add for XML docs */ + TidyUpperCaseTags, /**< Output tags in upper not lower case */ + TidyUpperCaseAttrs, /**< Output attributes in upper not lower case */ + TidyMakeBare, /**< Make bare HTML: remove Microsoft cruft */ + TidyMakeClean, /**< Replace presentational clutter by style rules */ + TidyGDocClean, /**< Clean up HTML exported from Google Docs */ + TidyLogicalEmphasis, /**< Replace i by em and b by strong */ + TidyDropPropAttrs, /**< Discard proprietary attributes */ + TidyDropFontTags, /**< Discard presentation tags */ + TidyDropEmptyElems, /**< Discard empty elements */ + TidyDropEmptyParas, /**< Discard empty p elements */ + TidyFixComments, /**< Fix comments with adjacent hyphens */ + TidyBreakBeforeBR, /**< Output newline before
or not? */ + + /* obsolete */ + TidyBurstSlides, /**< Create slides on each h2 element */ + + TidyNumEntities, /**< Use numeric entities */ + TidyQuoteMarks, /**< Output " marks as " */ + TidyQuoteNbsp, /**< Output non-breaking space as entity */ + TidyQuoteAmpersand, /**< Output naked ampersand as & */ + TidyWrapAttVals, /**< Wrap within attribute values */ + TidyWrapScriptlets, /**< Wrap within JavaScript string literals */ + TidyWrapSection, /**< Wrap within section tags */ + TidyWrapAsp, /**< Wrap within ASP pseudo elements */ + TidyWrapJste, /**< Wrap within JSTE pseudo elements */ + TidyWrapPhp, /**< Wrap within PHP pseudo elements */ + TidyFixBackslash, /**< Fix URLs by replacing \ with / */ + TidyIndentAttributes,/**< Newline+indent before each attribute */ + TidyXmlPIs, /**< If set to yes PIs must end with ?> */ + TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */ + TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */ + TidyEncloseBlockText,/**< If yes text in blocks is wrapped in P's */ + TidyKeepFileTimes, /**< If yes last modied time is preserved */ + TidyWord2000, /**< Draconian cleaning for Word2000 */ + TidyMark, /**< Add meta element indicating tidied doc */ + TidyEmacs, /**< If true format error output for GNU Emacs */ + TidyEmacsFile, /**< Name of current Emacs file */ + TidyLiteralAttribs, /**< If true attributes may use newlines */ + TidyBodyOnly, /**< Output BODY content only */ + TidyFixUri, /**< Applies URI encoding if necessary */ + TidyLowerLiterals, /**< Folds known attribute values to lower case */ + TidyHideComments, /**< Hides all (real) comments in output */ + TidyIndentCdata, /**< Indent section */ + TidyForceOutput, /**< Output document even if errors were found */ + TidyShowErrors, /**< Number of errors to put out */ + TidyAsciiChars, /**< Convert quotes and dashes to nearest ASCII char */ + TidyJoinClasses, /**< Join multiple class attributes */ + TidyJoinStyles, /**< Join multiple style attributes */ + TidyEscapeCdata, /**< Replace sections with escaped text */ + +#if SUPPORT_ASIAN_ENCODINGS + TidyLanguage, /**< Language property: not used for anything yet */ + TidyNCR, /**< Allow numeric character references */ +#else + TidyLanguageNotUsed, + TidyNCRNotUsed, +#endif +#if SUPPORT_UTF16_ENCODINGS + TidyOutputBOM, /**< Output a Byte Order Mark (BOM) for UTF-16 encodings */ + /**< auto: if input stream has BOM, we output a BOM */ +#else + TidyOutputBOMNotUsed, +#endif + + TidyReplaceColor, /**< Replace hex color attribute values with names */ + TidyCSSPrefix, /**< CSS class naming for -clean option */ + + TidyInlineTags, /**< Declared inline tags */ + TidyBlockTags, /**< Declared block tags */ + TidyEmptyTags, /**< Declared empty tags */ + TidyPreTags, /**< Declared pre tags */ + + TidyAccessibilityCheckLevel, /**< Accessibility check level + 0 (old style), or 1, 2, 3 */ + + TidyVertSpace, /**< degree to which markup is spread out vertically */ +#if SUPPORT_ASIAN_ENCODINGS + TidyPunctWrap, /**< consider punctuation and breaking spaces for wrapping */ +#else + TidyPunctWrapNotUsed, +#endif + TidyMergeEmphasis, /**< Merge nested B and I elements */ + TidyMergeDivs, /**< Merge multiple DIVs */ + TidyDecorateInferredUL, /**< Mark inferred UL elements with no indent CSS */ + TidyPreserveEntities, /**< Preserve entities */ + TidySortAttributes, /**< Sort attributes */ + TidyMergeSpans, /**< Merge multiple SPANs */ + TidyAnchorAsName, /**< Define anchors as name attributes */ + N_TIDY_OPTIONS /**< Must be last */ +} TidyOptionId; + +/** Option data types +*/ +typedef enum +{ + TidyString, /**< String */ + TidyInteger, /**< Integer or enumeration */ + TidyBoolean /**< Boolean flag */ +} TidyOptionType; + + +/** AutoBool values used by ParseBool, ParseTriState, ParseIndent, ParseBOM +*/ +typedef enum +{ + TidyNoState, /**< maps to 'no' */ + TidyYesState, /**< maps to 'yes' */ + TidyAutoState /**< Automatic */ +} TidyTriState; + +/** TidyNewline option values to control output line endings. +*/ +typedef enum +{ + TidyLF, /**< Use Unix style: LF */ + TidyCRLF, /**< Use DOS/Windows style: CR+LF */ + TidyCR /**< Use Macintosh style: CR */ +} TidyLineEnding; + + +/** Mode controlling treatment of doctype +*/ +typedef enum +{ + TidyDoctypeHtml5, /**< */ + TidyDoctypeOmit, /**< Omit DOCTYPE altogether */ + TidyDoctypeAuto, /**< Keep DOCTYPE in input. Set version to content */ + TidyDoctypeStrict, /**< Convert document to HTML 4 strict content model */ + TidyDoctypeLoose, /**< Convert document to HTML 4 transitional + content model */ + TidyDoctypeUser /**< Set DOCTYPE FPI explicitly */ +} TidyDoctypeModes; + +/** Mode controlling treatment of duplicate Attributes +*/ +typedef enum +{ + TidyKeepFirst, + TidyKeepLast +} TidyDupAttrModes; + +/** Mode controlling treatment of sorting attributes +*/ +typedef enum +{ + TidySortAttrNone, + TidySortAttrAlpha +} TidyAttrSortStrategy; + +/* I/O and Message handling interface +** +** By default, Tidy will define, create and use +** instances of input and output handlers for +** standard C buffered I/O (i.e. FILE* stdin, +** FILE* stdout and FILE* stderr for content +** input, content output and diagnostic output, +** respectively. A FILE* cfgFile input handler +** will be used for config files. Command line +** options will just be set directly. +*/ + +/** Message severity level +*/ +typedef enum +{ + TidyInfo, /**< Information about markup usage */ + TidyWarning, /**< Warning message */ + TidyConfig, /**< Configuration error */ + TidyAccess, /**< Accessibility message */ + TidyError, /**< Error message - output suppressed */ + TidyBadDocument, /**< I/O or file system error */ + TidyFatal /**< Crash! */ +} TidyReportLevel; + + +/* Document tree traversal functions +*/ + +/** Node types +*/ +typedef enum +{ + TidyNode_Root, /**< Root */ + TidyNode_DocType, /**< DOCTYPE */ + TidyNode_Comment, /**< Comment */ + TidyNode_ProcIns, /**< Processing Instruction */ + TidyNode_Text, /**< Text */ + TidyNode_Start, /**< Start Tag */ + TidyNode_End, /**< End Tag */ + TidyNode_StartEnd, /**< Start/End (empty) Tag */ + TidyNode_CDATA, /**< Unparsed Text */ + TidyNode_Section, /**< XML Section */ + TidyNode_Asp, /**< ASP Source */ + TidyNode_Jste, /**< JSTE Source */ + TidyNode_Php, /**< PHP Source */ + TidyNode_XmlDecl /**< XML Declaration */ +} TidyNodeType; + + +/** Known HTML element types +*/ +typedef enum +{ + TidyTag_UNKNOWN, /**< Unknown tag! */ + TidyTag_A, /**< A */ + TidyTag_ABBR, /**< ABBR */ + TidyTag_ACRONYM, /**< ACRONYM */ + TidyTag_ADDRESS, /**< ADDRESS */ + TidyTag_ALIGN, /**< ALIGN */ + TidyTag_APPLET, /**< APPLET */ + TidyTag_AREA, /**< AREA */ + TidyTag_B, /**< B */ + TidyTag_BASE, /**< BASE */ + TidyTag_BASEFONT, /**< BASEFONT */ + TidyTag_BDO, /**< BDO */ + TidyTag_BGSOUND, /**< BGSOUND */ + TidyTag_BIG, /**< BIG */ + TidyTag_BLINK, /**< BLINK */ + TidyTag_BLOCKQUOTE, /**< BLOCKQUOTE */ + TidyTag_BODY, /**< BODY */ + TidyTag_BR, /**< BR */ + TidyTag_BUTTON, /**< BUTTON */ + TidyTag_CAPTION, /**< CAPTION */ + TidyTag_CENTER, /**< CENTER */ + TidyTag_CITE, /**< CITE */ + TidyTag_CODE, /**< CODE */ + TidyTag_COL, /**< COL */ + TidyTag_COLGROUP, /**< COLGROUP */ + TidyTag_COMMENT, /**< COMMENT */ + TidyTag_DD, /**< DD */ + TidyTag_DEL, /**< DEL */ + TidyTag_DFN, /**< DFN */ + TidyTag_DIR, /**< DIR */ + TidyTag_DIV, /**< DIF */ + TidyTag_DL, /**< DL */ + TidyTag_DT, /**< DT */ + TidyTag_EM, /**< EM */ + TidyTag_EMBED, /**< EMBED */ + TidyTag_FIELDSET, /**< FIELDSET */ + TidyTag_FONT, /**< FONT */ + TidyTag_FORM, /**< FORM */ + TidyTag_FRAME, /**< FRAME */ + TidyTag_FRAMESET, /**< FRAMESET */ + TidyTag_H1, /**< H1 */ + TidyTag_H2, /**< H2 */ + TidyTag_H3, /**< H3 */ + TidyTag_H4, /**< H4 */ + TidyTag_H5, /**< H5 */ + TidyTag_H6, /**< H6 */ + TidyTag_HEAD, /**< HEAD */ + TidyTag_HR, /**< HR */ + TidyTag_HTML, /**< HTML */ + TidyTag_I, /**< I */ + TidyTag_IFRAME, /**< IFRAME */ + TidyTag_ILAYER, /**< ILAYER */ + TidyTag_IMG, /**< IMG */ + TidyTag_INPUT, /**< INPUT */ + TidyTag_INS, /**< INS */ + TidyTag_ISINDEX, /**< ISINDEX */ + TidyTag_KBD, /**< KBD */ + TidyTag_KEYGEN, /**< KEYGEN */ + TidyTag_LABEL, /**< LABEL */ + TidyTag_LAYER, /**< LAYER */ + TidyTag_LEGEND, /**< LEGEND */ + TidyTag_LI, /**< LI */ + TidyTag_LINK, /**< LINK */ + TidyTag_LISTING, /**< LISTING */ + TidyTag_MAP, /**< MAP */ + TidyTag_MARQUEE, /**< MARQUEE */ + TidyTag_MENU, /**< MENU */ + TidyTag_META, /**< META */ + TidyTag_MULTICOL, /**< MULTICOL */ + TidyTag_NOBR, /**< NOBR */ + TidyTag_NOEMBED, /**< NOEMBED */ + TidyTag_NOFRAMES, /**< NOFRAMES */ + TidyTag_NOLAYER, /**< NOLAYER */ + TidyTag_NOSAVE, /**< NOSAVE */ + TidyTag_NOSCRIPT, /**< NOSCRIPT */ + TidyTag_OBJECT, /**< OBJECT */ + TidyTag_OL, /**< OL */ + TidyTag_OPTGROUP, /**< OPTGROUP */ + TidyTag_OPTION, /**< OPTION */ + TidyTag_P, /**< P */ + TidyTag_PARAM, /**< PARAM */ + TidyTag_PLAINTEXT,/**< PLAINTEXT */ + TidyTag_PRE, /**< PRE */ + TidyTag_Q, /**< Q */ + TidyTag_RB, /**< RB */ + TidyTag_RBC, /**< RBC */ + TidyTag_RP, /**< RP */ + TidyTag_RT, /**< RT */ + TidyTag_RTC, /**< RTC */ + TidyTag_RUBY, /**< RUBY */ + TidyTag_S, /**< S */ + TidyTag_SAMP, /**< SAMP */ + TidyTag_SCRIPT, /**< SCRIPT */ + TidyTag_SELECT, /**< SELECT */ + TidyTag_SERVER, /**< SERVER */ + TidyTag_SERVLET, /**< SERVLET */ + TidyTag_SMALL, /**< SMALL */ + TidyTag_SPACER, /**< SPACER */ + TidyTag_SPAN, /**< SPAN */ + TidyTag_STRIKE, /**< STRIKE */ + TidyTag_STRONG, /**< STRONG */ + TidyTag_STYLE, /**< STYLE */ + TidyTag_SUB, /**< SUB */ + TidyTag_SUP, /**< SUP */ + TidyTag_TABLE, /**< TABLE */ + TidyTag_TBODY, /**< TBODY */ + TidyTag_TD, /**< TD */ + TidyTag_TEXTAREA, /**< TEXTAREA */ + TidyTag_TFOOT, /**< TFOOT */ + TidyTag_TH, /**< TH */ + TidyTag_THEAD, /**< THEAD */ + TidyTag_TITLE, /**< TITLE */ + TidyTag_TR, /**< TR */ + TidyTag_TT, /**< TT */ + TidyTag_U, /**< U */ + TidyTag_UL, /**< UL */ + TidyTag_VAR, /**< VAR */ + TidyTag_WBR, /**< WBR */ + TidyTag_XMP, /**< XMP */ + TidyTag_NEXTID, /**< NEXTID */ + + TidyTag_ARTICLE, + TidyTag_ASIDE, + TidyTag_AUDIO, + TidyTag_CANVAS, + TidyTag_COMMAND, + TidyTag_DATALIST, + TidyTag_DETAILS, + TidyTag_FIGCAPTION, + TidyTag_FIGURE, + TidyTag_FOOTER, + TidyTag_HEADER, + TidyTag_HGROUP, + TidyTag_MARK, + TidyTag_METER, + TidyTag_NAV, + TidyTag_OUTPUT, + TidyTag_PROGRESS, + TidyTag_SECTION, + TidyTag_SOURCE, + TidyTag_SUMMARY, + TidyTag_TIME, + TidyTag_TRACK, + TidyTag_VIDEO, + + N_TIDY_TAGS /**< Must be last */ +} TidyTagId; + +/* Attribute interrogation +*/ + +/** Known HTML attributes +*/ +typedef enum +{ + TidyAttr_UNKNOWN, /**< UNKNOWN= */ + TidyAttr_ABBR, /**< ABBR= */ + TidyAttr_ACCEPT, /**< ACCEPT= */ + TidyAttr_ACCEPT_CHARSET, /**< ACCEPT_CHARSET= */ + TidyAttr_ACCESSKEY, /**< ACCESSKEY= */ + TidyAttr_ACTION, /**< ACTION= */ + TidyAttr_ADD_DATE, /**< ADD_DATE= */ + TidyAttr_ALIGN, /**< ALIGN= */ + TidyAttr_ALINK, /**< ALINK= */ + TidyAttr_ALT, /**< ALT= */ + TidyAttr_ARCHIVE, /**< ARCHIVE= */ + TidyAttr_AXIS, /**< AXIS= */ + TidyAttr_BACKGROUND, /**< BACKGROUND= */ + TidyAttr_BGCOLOR, /**< BGCOLOR= */ + TidyAttr_BGPROPERTIES, /**< BGPROPERTIES= */ + TidyAttr_BORDER, /**< BORDER= */ + TidyAttr_BORDERCOLOR, /**< BORDERCOLOR= */ + TidyAttr_BOTTOMMARGIN, /**< BOTTOMMARGIN= */ + TidyAttr_CELLPADDING, /**< CELLPADDING= */ + TidyAttr_CELLSPACING, /**< CELLSPACING= */ + TidyAttr_CHAR, /**< CHAR= */ + TidyAttr_CHAROFF, /**< CHAROFF= */ + TidyAttr_CHARSET, /**< CHARSET= */ + TidyAttr_CHECKED, /**< CHECKED= */ + TidyAttr_CITE, /**< CITE= */ + TidyAttr_CLASS, /**< CLASS= */ + TidyAttr_CLASSID, /**< CLASSID= */ + TidyAttr_CLEAR, /**< CLEAR= */ + TidyAttr_CODE, /**< CODE= */ + TidyAttr_CODEBASE, /**< CODEBASE= */ + TidyAttr_CODETYPE, /**< CODETYPE= */ + TidyAttr_COLOR, /**< COLOR= */ + TidyAttr_COLS, /**< COLS= */ + TidyAttr_COLSPAN, /**< COLSPAN= */ + TidyAttr_COMPACT, /**< COMPACT= */ + TidyAttr_CONTENT, /**< CONTENT= */ + TidyAttr_COORDS, /**< COORDS= */ + TidyAttr_DATA, /**< DATA= */ + TidyAttr_DATAFLD, /**< DATAFLD= */ + TidyAttr_DATAFORMATAS, /**< DATAFORMATAS= */ + TidyAttr_DATAPAGESIZE, /**< DATAPAGESIZE= */ + TidyAttr_DATASRC, /**< DATASRC= */ + TidyAttr_DATETIME, /**< DATETIME= */ + TidyAttr_DECLARE, /**< DECLARE= */ + TidyAttr_DEFER, /**< DEFER= */ + TidyAttr_DIR, /**< DIR= */ + TidyAttr_DISABLED, /**< DISABLED= */ + TidyAttr_ENCODING, /**< ENCODING= */ + TidyAttr_ENCTYPE, /**< ENCTYPE= */ + TidyAttr_FACE, /**< FACE= */ + TidyAttr_FOR, /**< FOR= */ + TidyAttr_FRAME, /**< FRAME= */ + TidyAttr_FRAMEBORDER, /**< FRAMEBORDER= */ + TidyAttr_FRAMESPACING, /**< FRAMESPACING= */ + TidyAttr_GRIDX, /**< GRIDX= */ + TidyAttr_GRIDY, /**< GRIDY= */ + TidyAttr_HEADERS, /**< HEADERS= */ + TidyAttr_HEIGHT, /**< HEIGHT= */ + TidyAttr_HREF, /**< HREF= */ + TidyAttr_HREFLANG, /**< HREFLANG= */ + TidyAttr_HSPACE, /**< HSPACE= */ + TidyAttr_HTTP_EQUIV, /**< HTTP_EQUIV= */ + TidyAttr_ID, /**< ID= */ + TidyAttr_ISMAP, /**< ISMAP= */ + TidyAttr_ITEMPROP, /**< ITEMPROP= */ + TidyAttr_LABEL, /**< LABEL= */ + TidyAttr_LANG, /**< LANG= */ + TidyAttr_LANGUAGE, /**< LANGUAGE= */ + TidyAttr_LAST_MODIFIED, /**< LAST_MODIFIED= */ + TidyAttr_LAST_VISIT, /**< LAST_VISIT= */ + TidyAttr_LEFTMARGIN, /**< LEFTMARGIN= */ + TidyAttr_LINK, /**< LINK= */ + TidyAttr_LONGDESC, /**< LONGDESC= */ + TidyAttr_LOWSRC, /**< LOWSRC= */ + TidyAttr_MARGINHEIGHT, /**< MARGINHEIGHT= */ + TidyAttr_MARGINWIDTH, /**< MARGINWIDTH= */ + TidyAttr_MAXLENGTH, /**< MAXLENGTH= */ + TidyAttr_MEDIA, /**< MEDIA= */ + TidyAttr_METHOD, /**< METHOD= */ + TidyAttr_MULTIPLE, /**< MULTIPLE= */ + TidyAttr_NAME, /**< NAME= */ + TidyAttr_NOHREF, /**< NOHREF= */ + TidyAttr_NORESIZE, /**< NORESIZE= */ + TidyAttr_NOSHADE, /**< NOSHADE= */ + TidyAttr_NOWRAP, /**< NOWRAP= */ + TidyAttr_OBJECT, /**< OBJECT= */ + TidyAttr_OnAFTERUPDATE, /**< OnAFTERUPDATE= */ + TidyAttr_OnBEFOREUNLOAD, /**< OnBEFOREUNLOAD= */ + TidyAttr_OnBEFOREUPDATE, /**< OnBEFOREUPDATE= */ + TidyAttr_OnBLUR, /**< OnBLUR= */ + TidyAttr_OnCHANGE, /**< OnCHANGE= */ + TidyAttr_OnCLICK, /**< OnCLICK= */ + TidyAttr_OnDATAAVAILABLE, /**< OnDATAAVAILABLE= */ + TidyAttr_OnDATASETCHANGED, /**< OnDATASETCHANGED= */ + TidyAttr_OnDATASETCOMPLETE, /**< OnDATASETCOMPLETE= */ + TidyAttr_OnDBLCLICK, /**< OnDBLCLICK= */ + TidyAttr_OnERRORUPDATE, /**< OnERRORUPDATE= */ + TidyAttr_OnFOCUS, /**< OnFOCUS= */ + TidyAttr_OnKEYDOWN, /**< OnKEYDOWN= */ + TidyAttr_OnKEYPRESS, /**< OnKEYPRESS= */ + TidyAttr_OnKEYUP, /**< OnKEYUP= */ + TidyAttr_OnLOAD, /**< OnLOAD= */ + TidyAttr_OnMOUSEDOWN, /**< OnMOUSEDOWN= */ + TidyAttr_OnMOUSEMOVE, /**< OnMOUSEMOVE= */ + TidyAttr_OnMOUSEOUT, /**< OnMOUSEOUT= */ + TidyAttr_OnMOUSEOVER, /**< OnMOUSEOVER= */ + TidyAttr_OnMOUSEUP, /**< OnMOUSEUP= */ + TidyAttr_OnRESET, /**< OnRESET= */ + TidyAttr_OnROWENTER, /**< OnROWENTER= */ + TidyAttr_OnROWEXIT, /**< OnROWEXIT= */ + TidyAttr_OnSELECT, /**< OnSELECT= */ + TidyAttr_OnSUBMIT, /**< OnSUBMIT= */ + TidyAttr_OnUNLOAD, /**< OnUNLOAD= */ + TidyAttr_PROFILE, /**< PROFILE= */ + TidyAttr_PROMPT, /**< PROMPT= */ + TidyAttr_RBSPAN, /**< RBSPAN= */ + TidyAttr_READONLY, /**< READONLY= */ + TidyAttr_REL, /**< REL= */ + TidyAttr_REV, /**< REV= */ + TidyAttr_RIGHTMARGIN, /**< RIGHTMARGIN= */ + TidyAttr_ROWS, /**< ROWS= */ + TidyAttr_ROWSPAN, /**< ROWSPAN= */ + TidyAttr_RULES, /**< RULES= */ + TidyAttr_SCHEME, /**< SCHEME= */ + TidyAttr_SCOPE, /**< SCOPE= */ + TidyAttr_SCROLLING, /**< SCROLLING= */ + TidyAttr_SELECTED, /**< SELECTED= */ + TidyAttr_SHAPE, /**< SHAPE= */ + TidyAttr_SHOWGRID, /**< SHOWGRID= */ + TidyAttr_SHOWGRIDX, /**< SHOWGRIDX= */ + TidyAttr_SHOWGRIDY, /**< SHOWGRIDY= */ + TidyAttr_SIZE, /**< SIZE= */ + TidyAttr_SPAN, /**< SPAN= */ + TidyAttr_SRC, /**< SRC= */ + TidyAttr_STANDBY, /**< STANDBY= */ + TidyAttr_START, /**< START= */ + TidyAttr_STYLE, /**< STYLE= */ + TidyAttr_SUMMARY, /**< SUMMARY= */ + TidyAttr_TABINDEX, /**< TABINDEX= */ + TidyAttr_TARGET, /**< TARGET= */ + TidyAttr_TEXT, /**< TEXT= */ + TidyAttr_TITLE, /**< TITLE= */ + TidyAttr_TOPMARGIN, /**< TOPMARGIN= */ + TidyAttr_TYPE, /**< TYPE= */ + TidyAttr_USEMAP, /**< USEMAP= */ + TidyAttr_VALIGN, /**< VALIGN= */ + TidyAttr_VALUE, /**< VALUE= */ + TidyAttr_VALUETYPE, /**< VALUETYPE= */ + TidyAttr_VERSION, /**< VERSION= */ + TidyAttr_VLINK, /**< VLINK= */ + TidyAttr_VSPACE, /**< VSPACE= */ + TidyAttr_WIDTH, /**< WIDTH= */ + TidyAttr_WRAP, /**< WRAP= */ + TidyAttr_XML_LANG, /**< XML_LANG= */ + TidyAttr_XML_SPACE, /**< XML_SPACE= */ + TidyAttr_XMLNS, /**< XMLNS= */ + + TidyAttr_EVENT, /**< EVENT= */ + TidyAttr_METHODS, /**< METHODS= */ + TidyAttr_N, /**< N= */ + TidyAttr_SDAFORM, /**< SDAFORM= */ + TidyAttr_SDAPREF, /**< SDAPREF= */ + TidyAttr_SDASUFF, /**< SDASUFF= */ + TidyAttr_URN, /**< URN= */ + + TidyAttr_ASYNC, + TidyAttr_AUTOCOMPLETE, + TidyAttr_AUTOFOCUS, + TidyAttr_AUTOPLAY, + TidyAttr_CHALLENGE, + TidyAttr_CONTENTEDITABLE, + TidyAttr_CONTEXTMENU, + TidyAttr_CONTROLS, + TidyAttr_DEFAULT, + TidyAttr_DIRNAME, + TidyAttr_DRAGGABLE, + TidyAttr_DROPZONE, + TidyAttr_FORM, + TidyAttr_FORMACTION, + TidyAttr_FORMENCTYPE, + TidyAttr_FORMMETHOD, + TidyAttr_FORMNOVALIDATE, + TidyAttr_FORMTARGET, + TidyAttr_HIDDEN, + TidyAttr_HIGH, + TidyAttr_ICON, + TidyAttr_KEYTYPE, + TidyAttr_KIND, + TidyAttr_LIST, + TidyAttr_LOOP, + TidyAttr_LOW, + TidyAttr_MANIFEST, + TidyAttr_MAX, + TidyAttr_MEDIAGROUP, + TidyAttr_MIN, + TidyAttr_NOVALIDATE, + TidyAttr_OPEN, + TidyAttr_OPTIMUM, + TidyAttr_OnABORT, + TidyAttr_OnAFTERPRINT, + TidyAttr_OnBEFOREPRINT, + TidyAttr_OnCANPLAY, + TidyAttr_OnCANPLAYTHROUGH, + TidyAttr_OnCONTEXTMENU, + TidyAttr_OnCUECHANGE, + TidyAttr_OnDRAG, + TidyAttr_OnDRAGEND, + TidyAttr_OnDRAGENTER, + TidyAttr_OnDRAGLEAVE, + TidyAttr_OnDRAGOVER, + TidyAttr_OnDRAGSTART, + TidyAttr_OnDROP, + TidyAttr_OnDURATIONCHANGE, + TidyAttr_OnEMPTIED, + TidyAttr_OnENDED, + TidyAttr_OnERROR, + TidyAttr_OnHASHCHANGE, + TidyAttr_OnINPUT, + TidyAttr_OnINVALID, + TidyAttr_OnLOADEDDATA, + TidyAttr_OnLOADEDMETADATA, + TidyAttr_OnLOADSTART, + TidyAttr_OnMESSAGE, + TidyAttr_OnMOUSEWHEEL, + TidyAttr_OnOFFLINE, + TidyAttr_OnONLINE, + TidyAttr_OnPAGEHIDE, + TidyAttr_OnPAGESHOW, + TidyAttr_OnPAUSE, + TidyAttr_OnPLAY, + TidyAttr_OnPLAYING, + TidyAttr_OnPOPSTATE, + TidyAttr_OnPROGRESS, + TidyAttr_OnRATECHANGE, + TidyAttr_OnREADYSTATECHANGE, + TidyAttr_OnREDO, + TidyAttr_OnRESIZE, + TidyAttr_OnSCROLL, + TidyAttr_OnSEEKED, + TidyAttr_OnSEEKING, + TidyAttr_OnSHOW, + TidyAttr_OnSTALLED, + TidyAttr_OnSTORAGE, + TidyAttr_OnSUSPEND, + TidyAttr_OnTIMEUPDATE, + TidyAttr_OnUNDO, + TidyAttr_OnVOLUMECHANGE, + TidyAttr_OnWAITING, + TidyAttr_PATTERN, + TidyAttr_PLACEHOLDER, + TidyAttr_POSTER, + TidyAttr_PRELOAD, + TidyAttr_PUBDATE, + TidyAttr_RADIOGROUP, + TidyAttr_REQUIRED, + TidyAttr_REVERSED, + TidyAttr_SANDBOX, + TidyAttr_SCOPED, + TidyAttr_SEAMLESS, + TidyAttr_SIZES, + TidyAttr_SPELLCHECK, + TidyAttr_SRCDOC, + TidyAttr_SRCLANG, + TidyAttr_STEP, + + + N_TIDY_ATTRIBS /**< Must be last */ +} TidyAttrId; + +#ifdef __cplusplus +} /* extern "C" */ +#endif +#endif /* __TIDYENUM_H__ */ diff --git a/deps/tidy-html5-ios/lib/libtidy.xcframework/Info.plist b/deps/tidy-html5-ios/lib/libtidy.xcframework/Info.plist new file mode 100644 index 000000000..067a5412d --- /dev/null +++ b/deps/tidy-html5-ios/lib/libtidy.xcframework/Info.plist @@ -0,0 +1,43 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_i386_x86_64-simulator + LibraryPath + libtidy.a + SupportedArchitectures + + arm64 + i386 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7_armv7s + LibraryPath + libtidy.a + SupportedArchitectures + + arm64 + armv7 + armv7s + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/deps/tidy-html5-ios/lib/libtidy.xcframework/ios-arm64_armv7_armv7s/libtidy.a b/deps/tidy-html5-ios/lib/libtidy.xcframework/ios-arm64_armv7_armv7s/libtidy.a new file mode 100644 index 000000000..c86e1840a Binary files /dev/null and b/deps/tidy-html5-ios/lib/libtidy.xcframework/ios-arm64_armv7_armv7s/libtidy.a differ diff --git a/deps/tidy-html5-ios/lib/libtidy.xcframework/ios-arm64_i386_x86_64-simulator/libtidy.a b/deps/tidy-html5-ios/lib/libtidy.xcframework/ios-arm64_i386_x86_64-simulator/libtidy.a new file mode 100644 index 000000000..70a917b40 Binary files /dev/null and b/deps/tidy-html5-ios/lib/libtidy.xcframework/ios-arm64_i386_x86_64-simulator/libtidy.a differ diff --git a/libetpan b/libetpan new file mode 160000 index 000000000..f9ae58246 --- /dev/null +++ b/libetpan @@ -0,0 +1 @@ +Subproject commit f9ae58246d31ac765e0b542aa5c21d2aad36bbab diff --git a/scripts/build-ctemplate-ios.sh b/scripts/build-ctemplate-ios.sh index 43561617d..cf2843d2e 100755 --- a/scripts/build-ctemplate-ios.sh +++ b/scripts/build-ctemplate-ios.sh @@ -12,6 +12,7 @@ name="ctemplate-ios" xcode_target="ctemplate-ios" xcode_project="ctemplate.xcodeproj" library="libctemplate-ios.a" +xcframework="libctemplate-ios.xcframework" embedded_deps="" build_git_ios diff --git a/scripts/build-tidy-ios.sh b/scripts/build-tidy-ios.sh index 5a8406747..0c5a226c8 100755 --- a/scripts/build-tidy-ios.sh +++ b/scripts/build-tidy-ios.sh @@ -12,6 +12,7 @@ name="tidy-html5-ios" xcode_target="tidy" xcode_project="Tidy.xcodeproj" library="libtidy.a" +xcframework="libtidy.xcframework" embedded_deps="" build_git_ios diff --git a/scripts/get-ios.sh b/scripts/get-ios.sh index 69ba63070..a569ee652 100755 --- a/scripts/get-ios.sh +++ b/scripts/get-ios.sh @@ -11,19 +11,3 @@ for dep in $deps ; do name="$dep" get_prebuilt_dep done - -deps+=" libsasl-ios" -if test "x$CONFIGURATION_BUILD_DIR" != x ; then - mkdir -p "$CONFIGURATION_BUILD_DIR" - cd "$scriptpath/../Externals" - for dep in $deps ; do - if test -d "$dep" ; then - if test -d "$dep"/lib ; then - rsync -a "$dep"/lib/ "$CONFIGURATION_BUILD_DIR" - fi - if test -d "$dep"/include ; then - rsync -a "$dep"/include/ "$CONFIGURATION_BUILD_DIR/include/" - fi - fi - done -fi diff --git a/scripts/include.sh/build-dep.sh b/scripts/include.sh/build-dep.sh index 58263133b..77bc26837 100755 --- a/scripts/include.sh/build-dep.sh +++ b/scripts/include.sh/build-dep.sh @@ -6,7 +6,7 @@ build_git_ios() return fi - simarchs="i386 x86_64" + simarchs="i386 x86_64 arm64" sdkminversion="7.0" sdkversion="`xcodebuild -showsdks 2>/dev/null | grep iphoneos | sed 's/.*iphoneos\(.*\)/\1/'`" devicearchs="armv7 armv7s arm64" @@ -104,9 +104,10 @@ build_git_ios() else mv Release-iphoneos/include "$name-$version/$name" fi - lipo -create "Release-iphoneos/$library" \ - "Release-iphonesimulator/$library" \ - -output "$name-$version/$name/lib/$library" + xcodebuild -create-xcframework \ + -library "Release-iphoneos/$library" \ + -library "Release-iphonesimulator/$library" \ + -output "$name-$version/$name/lib/$xcframework" for dep in $embedded_deps ; do if test -d "$srcdir/$name/build-mac/$dep" ; then mv "$srcdir/$name/build-mac/$dep" "$name-$version"